3

I have existing project created a year ago. After AppStore's 64 bit requirement announcements, I had to include arm64 architecture into my project

But after adding arm64 into appTarget -> Build Settings -> Valid Architectures all the setImage: forState methods of all UIButton objects stopped working, while setBackGroundImage: forState is working normally.

UIButton *button = [[UIButton alloc] initWithFrame:CGRectMake(10, 10, 20, 20)];
[button setImage:image forState:UIControlStateNormal];

To test this oddity I created new project and created UIButton and used setImage: forState method, everything is working as expected.

If I remove back arm64 architecture, every thing is ok with my project. I don't know what I did wrong with my project.

enter image description here

Shamsiddin Saidov
  • 2,281
  • 4
  • 23
  • 35
  • did you find a solution? I've been testing for 3 days! – Kasas Nov 29 '17 at 12:10
  • I don't remember exactly how did I fixed this problem. But if I'm not mistaken, it should be some method created in UIImage (or UIColor) class category casing this bug. So check your class categories, if they are overriding any native methods. – Shamsiddin Saidov Nov 29 '17 at 12:19
  • I think the answer is this: https://stackoverflow.com/a/20944188/1178825 – Kasas Nov 29 '17 at 12:21
  • yep, I remembered it should be `setAlpha:` method created in UIButton category. – Shamsiddin Saidov Nov 29 '17 at 12:24

1 Answers1

0

You should use UIControlState tydef instead of int [1]

[button setImage:image forState:UIControlStateNormal]

Pavel Gatilov
  • 2,570
  • 2
  • 18
  • 31