我的XCode项目中有20多个按钮,我想为每个按钮添加边框。是否有可能喜欢选择情节提要中的所有UIButton,然后对其执行代码?

// For example
buttons.borderColor = [[UIColor darkGrayColor] CGColor];
buttons.cornerRadius = 8;
buttons.borderWidth = 1;

最佳答案

您可以使用UIAppearance协议。
https://developer.apple.com/library/ios/documentation/UIKit/Reference/UIAppearance_Protocol/index.html

关于ios - 为ViewController中的每个按钮添加样式,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/27193400/

10-14 16:50