UIButton *button = [UIButton buttonWithType:UIButtonTypeSystem]; // sysytem 自带渲染效果,就是有种按下去的感觉
UIImage *image = [UIImage imageNamed:@"5ZPU059BYTUY)CE9ZIKWEPN.jpg"];
[button setImage:image forState:UIControlStateNormal];
button.frame = CGRectMake(40, 40, 100, 100);
[self.view addSubview:button];
将红色的那句代码改成
// [button setImage:[image imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal] forState:UIControlStateNormal]; // 改变图片的渲染方式,是原始的, 就不会受系统的影响了
iOS(UIbutton添加图片时候,不显示图片只显示蓝色)
原文地址:http://blog.csdn.net/s133315202/article/details/46572791