Vad*_*Vad 1 iphone xcode objective-c uibutton ios
我想绘制一个UIButton使用轮廓的文本,即笔画.所以我尝试使用titleLabel制作我自己的自定义标签并分配到UIButton.titleLabel哪个不起作用.有人提到我可以添加UILabel,UIButton但我不确定这个解决方案是好的.
有人可以推荐一个稳定的方法来解决这个问题 谢谢.
您可以使用
- (void)setAttributedTitle:(NSAttributedString *)title forState:(UIControlState)state
Run Code Online (Sandbox Code Playgroud)
的方法UIButton.
例如.像这样的属性字符串
NSAttributedString *attributedText =
[[NSAttributedString alloc] initWithString:title
attributes:@{NSStrokeWidthAttributeName: [NSNumber numberWithInt:-6],
NSStrokeColorAttributeName: titleBorderColor,
NSForegroundColorAttributeName: [UIColor whiteColor]}];
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1594 次 |
| 最近记录: |