xcode - Comparing image views in iOS 8 not working -
i using button multiple image view, example after clicking on button image of button change used that:
if(button.imageview.image ==[uiimage imagenamed:@"addfriendpressed.png"]){ }
this working in ios 7 , not ios8. solutions please?
- (bool)image:(uiimage *)image1 isequalto:(uiimage *)image2 { nsdata *data1 = uiimagepngrepresentation(image1); nsdata *data2 = uiimagepngrepresentation(image2); return [data1 isequal:data2]; }
use isequal :
if([button.imageview.image isequal:[uiimage imagenamed:@"addfriendpressed.png"]]){ }
or
if([[button backgroundimageforstate:uicontrolstatenormal] isequal: [uiimage imagenamed:@"addfriendpressed.png"]]){ }
Comments
Post a Comment