ios - Determine Button Background Image - Objective-C (Xcode) -



ios - Determine Button Background Image - Objective-C (Xcode) -

i have view controller different buttons background images assigned. header file looks follows:

@interface imageselect : uiviewcontroller - (ibaction)imagebutton:(id)sender; - (ibaction)done:(id)sender; @property(nonatomic, readonly, retain) uiimage *currentimage; @end

and section of main file contains button method looks like:

- (ibaction)imagebutton:(id)sender { if ([@"railway-336702_1280.jpg" isequal:self.currentimage]) { img = @"railway-336702_1280.jpg"; nslog(@"test"); } }

i wanting save image name nsstring called img. currently, code runs doesn't perform save img.

a simpler way be: if wanted check whether uibutton contains image set, utilize tag property:

let set image image named: railway-336702_1280.jpg

set tag simpler "1280".

then check tag against integer. , should alter image again, alter tag correspondingly.

if (((uibutton*)sender).tag == 1280) { // stuff }

ios objective-c uibutton

Comments

Popular posts from this blog

php - Android app custom user registration and login with cookie using facebook sdk -

django - Access session in user model .save() -

php - .htaccess Multiple Rewrite Rules / Prioritizing -