[英]UIButtons wont change image
I set a number of UIButtons in IB. 我在IB中设置了许多UIButton。 When I try to set them in the code using
当我尝试在代码中设置它们时使用
[A1 setImage:[UIImage imageNamed:@"t1A.png"] forState:UIControlStateNormal];
This does not set the image. 这不会设置图像。 Could it be that the button wont change if it is set in IB?
可能是按钮在IB中设置时不会改变吗?
Thanks 谢谢
尝试这个
[A1 setBackgroundImage:[UIImage imageNamed:@"t1A.png"] forState:UIControlStateNormal];
Apple Docs: 苹果文档:
- (void)setBackgroundImage:(UIImage *)image forState:(UIControlState)state
Try this: 尝试这个:
[YourButton setBackgroundImage:[UIImage imageNamed:@"XYZ.png"] forState:UIControlStateNormal];
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.