Viv*_*wat 15
这就是你需要的
UIButton *btn = [UIButton buttonWithType:UIButtonTypeCustom];
btn.frame = CGRectMake(5,10,300,20);
[self.view addSubview:btn];
NSMutableAttributedString *attrStr = [[NSMutableAttributedString alloc] initWithString:[NSString stringWithFormat:@"100 Photos"]];
[attrStr addAttribute:NSForegroundColorAttributeName value:[UIColor redColor] range:NSMakeRange(0, 3)];
[btn setAttributedTitle:attrStr forState:UIControlStateNormal];
Run Code Online (Sandbox Code Playgroud)
Kum*_* KL 12
在storyBoard中:关注ScreenShot.



对于编程:这里已经有很多答案帖子在这里为属性文本和如果你想为UIButton 设置BackgroundImage 设置一个按钮背景图像iPhone以编程方式
| 归档时间: |
|
| 查看次数: |
6929 次 |
| 最近记录: |