标签:lips void details oid nbsp gre tom code etop
UIButton *openVipBtn = [UIButton buttonWithType:UIButtonTypeCustom]; openVipBtn.frame = CGRectMake(0, 0, 44, 44); [openVipBtn setTitleColor:[UIColor colorWithHexString:@"E7923A"] forState:UIControlStateNormal]; openVipBtn.titleLabel.font = [UIFont systemFontOfSize:13]; [openVipBtn setImage:[UIImage imageNamed:@"bookDetails_IntoVIP"] forState:UIControlStateNormal]; openVipBtn.backgroundColor = [UIColor colorWithHexString:@"FFF7ED"]; openVipBtn.clipsToBounds=YES; openVipBtn.layer.cornerRadius=15; [self.view addSubview:openVipBtn];
使用:
[self.view setOpenVipBtnTitle:@"VIP可免费阅读本书,开通VIP"];
- (void)setOpenVipBtnTitle:(NSString *)title { [self.openVipBtn setTitle:title forState:UIControlStateNormal]; CGFloat leftlab = [title sizeWithAttributes:@{NSFontAttributeName : self.openVipBtn.titleLabel.font}].width; [self.openVipBtn setImageEdgeInsets:UIEdgeInsetsMake(0, leftlab + 70, 0, 0)]; [self.openVipBtn setTitleEdgeInsets:UIEdgeInsetsMake(0, -40, 0, 0)]; }
标签:lips void details oid nbsp gre tom code etop
原文地址:http://www.cnblogs.com/qiyiyifan/p/7641780.html