Friday 15 February 2013

ios - Change Back And Forth UIImages -


Hi IA ???? One method is trying to get an image to change in the call and if the origin of the method is remembered the image returns

  - (zero) change {if ((player. Image = [UIImage imageNamed: @ "first.png"])) {player.image = [UIImage imageNamed: @ "second.png"])); } Other {player.image = [UIImage imageNamed: @ "first.png"])); }}   

This job changes the "first page" image to "second page", but when it is called again it does not happen.

Where am I going wrong?

As told by Michael Doderman, the way you are comparing two UIImages That's wrong . Can not you just keep the NSString property that tells you the image being shown?

  - (zero) change {if ([self.displayedImageTitle isqualToString: @ "first.png"]) {Player.image = [UIImage imageNamed: @ "second.png"])) ; Self.displayedImageTitle = @ "second.png"; } Other {player.image = [UIImage imageNamed: @ "first.png"])); Self.displayedImageTitle = @ "first.png"; }}    

No comments:

Post a Comment