Reputation: 3150
I am trying to set up a fairly simple Storyboard/Interface builder app with aUITableViewController
, with two prototype cells.
The first prototype cell displays information on the main UILabel
and the second prototype cell contains aUIButton
. I have connected the button'stouchUpInside
action to some piece of code where I want to execute stuff and modify the button's title:
- (IBAction)startButtonTouchUpInside:(UIButton *)sender {
[self doSomeStuff];
sender.titleLabel.text = @"Clicked";
}
However when I test the app and click on the UIButton
, theUIButtons
title changes for a fraction of a second before being reverted to title as provided in the Stroyboard interface builder.
Is this normal?
Upvotes: 0
Views: 149
Reputation: 39988
From the apple docs of titleLabel
Do not use the label object to set the text color or the shadow color. Instead, use the setTitleColor:forState: and setTitleShadowColor:forState: methods of this class to make those changes.
Similarly for text you should use setTitle:forState:
[sender.titleLabel setTitle:@"Clicked" forState:UIControlStateNormal];
Upvotes: 1