This is very useful code to access any view's object in code on the basis of it's tag value.
The code I use here to update the image of weather button in any function(e.g. viewDidLoad) :
button=(UIButton *)[self.view viewWithTag:1];
The code I use here to update the image of weather button in any function(e.g. viewDidLoad) :
button=(UIButton *)[self.view viewWithTag:1];
button.selected = YES;
button.highlighted = YES;
BImage = [UIImage imageNamed:@"image.jpg"];
[button setImage:BImage forState:UIControlStateNormal];
Explanation:
button=(UIButton *)[self.view viewWithTag:1];
Here, we are typecasting any view object with tag value 1 to UIButton type. The tag value will be set in IB(you can also do programmatically).
Nice post with great details. I really appreciate your idea. Thanks for sharing.
ReplyDelete-------------------------------------------------------------------------------------------------
iPhone 5 App Development & iPad Application Developer