Skip to content

Instantly share code, notes, and snippets.

@puls
Last active August 29, 2015 13:57
Show Gist options
  • Select an option

  • Save puls/9492183 to your computer and use it in GitHub Desktop.

Select an option

Save puls/9492183 to your computer and use it in GitHub Desktop.
- (void)viewDidLoad;
{
[super viewDidLoad];
self.button.enabled = NO;
[self.button setTitle:@"Foo" forState:UIControlStateNormal];
}
- (IBAction)changeTitle:(id)sender;
{
[self.button setTitle:@"Bar" forState:UIControlStateNormal];
NSLog(@"current title: %@; title label text: %@", self.button.currentTitle, self.button.titleLabel.text);
// Prints "current title: Bar; title label text: Foo"
dispatch_after(dispatch_time(DISPATCH_TIME_NOW, (int64_t)(1.0 * NSEC_PER_SEC)), dispatch_get_main_queue(), ^{
NSLog(@"current title: %@, title label text: %@", self.button.currentTitle, self.button.titleLabel.text);
// on iOS 7.0, prints "current title: Bar, title label text: Bar"
// on iOS 7.1, prints "current title: Bar, title label text: Foo"
});
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment