xcode - iOS: change png in a bar button item -
I have repeatedly put items in a bar, and I set it with a PNG (first page) And when I push it I want to change my PNG in "PGPNG"
This code does not work properly:
UIImage * first = [UIImage imageNamed: @ "Before .png"]; UIImage * Second = [UIImage imageNamed: @ "second.png"]; If ([sender is selected]) {[Sender Setizes: State for First: UControllStatEnormal]; [Sender set selected: no]; } Other {[Sender set image: State for second: UIControlState selected); [Sender set selected: yes]; }
current responder does not know that UIBarButtonItem does UIButton is not deprived, so the setImage: forState: will surely work not UIBarButtonItems not can be set to different states. You can , however, use something like this (declared): sender.image = [UIImage imageNamed: @ "first.png"];
Comments
Post a Comment