Sunday, 15 September 2013

ios - Can't overwrite UIButton options programmatically -


Fixed I had to clear the background image of the button in the IB.


I think there are two buttons, if different images based on the statement should be used. I created buttons in the IB (and their size, set the barriers), but I would like to change their appearance to viewDidLoad I have made a method to handle variations, but unfortunately it does not work . When I run the app, I can login to the appropriate NSLog, but nothing changes. It seems that my setImage: forState: methods can not overwrite the storyboard option Do anyone have an idea what was wrong?

- (zero) viewDidoadload {[Super Viewedload]; [Self set button layout]; } - (zero) setButtonLayout {if ([[PFUser currentUser] [@ "status"] is EqualToString: @ "active"]) {[self.bttn1 setImage: [UIImage imageNamed: @ "01-normal.png"] forState : UIControlStateNormal]; [Sb.BTN 1 set image: [UIImage imageNamed: @ "01-selected.png"] forState: UIControlStateSelected]; [Sb.btn2 set image: [UIImage imageNamed: @ "02-General Page"] forState: UIControlStateNormal]; [Sb.btn2 set image: [UIImage imageNamed: @ "02-selected.png"] forState: UIControlStateSelected]; NSLog (@ "1.button"); } If ([[Pfusor current user] [@ "status"] extolstration: @ "idle"]) [[self BTN 3 set image: [UIImage image nominated: @ "03-General Page"] Static: UControllStateAnimal]; [Auto BTN 3 set image: [UIImage imageNamed: @ "03-selected.png"] forState: UIControlStateSelected]; [BTN 4 Set Image: [UIImage imageNamed: @ "04-General Page"] forState: UIControlStateNormal]; [BTN 4 set image: [UIImage imageNamed: @ "04-selected.png"] forState: UIControlStateSelected]; NSLog (@ "2.button"); }}

WillAppear: method to view your initialization with viewWillLoad method. / P>


No comments:

Post a Comment