[英]UIButton imageEdgeInsets not updating at run time
So here is my code, it's fairly strait forward. 所以这是我的代码,相当向前。
CGFloat spaceing = 5;
self.premiumButton.imageEdgeInsets = UIEdgeInsetsMake(spaceing,spaceing,spaceing,spaceing)
NSLog(@"immage - %@", NSStringFromUIEdgeInsets(self.premiumButton.imageEdgeInsets));
right should update the Image to be in the center of the button with a 5 point padding on all sides(I've removed the text for this particular state) 右侧应将Image更新为按钮的中心,并在所有侧面各加5点填充(我已删除了此特定状态的文本)
but the log comes back with 但是日志返回
immage - {0, 0, 0, 0} 图片-{0,0,0,0}
Infact I placed this in initWithCoder which is how this view is being built from a xib and got the same thing despite the fact that in the interface builder I set everything. 实际上,我将其放在initWithCoder中,这是从xib构建此视图的方式,尽管在接口构建器中我已设置了所有内容,但得到的结果却是相同的。
What am I missing everything else on stack overflow has code samples that look just like mine marked as the answer but it's not doing anything for me. 我在堆栈溢出中缺少的所有其他内容都有看起来像我的代码示例一样被标记为答案,但它对我没有任何帮助。
I have tried the UIButton setTitleEdgeInsets method but no go. 我已经尝试过UIButton setTitleEdgeInsets方法,但是没有成功。
- (void)layoutSubviews update imageEdgeInsets
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.