Friday, July 11, 2014

Iphone: UIButton text setting - wrong and correct way

Wrong way:
       self.notificationButton.titleLabel.text=[NSString stringWithFormat:@"%i",notificationCount];
Correct way:
        [self.notificationButton setTitle:[NSString stringWithFormat:@"%i",notificationCount] forState:UIControlStateNormal];


By setting in a wrong way, title changed to default (set using storyboard) when user will click

No comments:

Post a Comment