我正在使用 SmileyBorg的 PureLayout一些自动布局魔法的库。
如何添加 UIButtonTypeCustom
?
普通按钮将使用以下纯布局 UIButton 类方法初始化:
self.myButton = [UIButton newAutoLayoutView];
自定义 UIButtons
初始化为
UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
因为我不能做类似的事情
self.myButton = [[UIButton buttonWithType:UIButtonTypeCustom] newAutoLayoutView];
并且没有“buttonType”属性来设置后初始化 - 我该如何结合 在 PureLayout 中创建自定义 UIButton 的这些步骤?
最佳答案
UIButton 默认为 UIButtonTypeCustom,因此您将能够使用:
self.myButton = [UIButton newAutoLayoutView];
为了好玩,我建议你使用 NSLog/printf self.myButton.buttonType
!
关于ios - 使用 PureLayout 自定义 UIButton,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/25849248/