Reputation: 1430
The following code basically does work, only the titleLabel is not shown when the result is displayed.
buttonRect
is just a CGRect
containing the buttons frame. I don't think the cause of the problem is there, because the button is displayed at the position he should be at.
[contactButton.titleLabel center]
did not help, bringing the subview titleLabel to front didn't either.
UIButton *contactButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];
contactButton.frame = buttonRect;
contactButton.titleLabel.text = @"Contact Someone!";
[contactButton addTarget:self action:@selector(showContactWindow) forControlEvents:UIControlEventTouchUpInside];
[self.tabBarController.view addSubview:contactButton];
I really have no idea what could be causing this.
Upvotes: 1
Views: 722
Reputation: 9593
[myButton setTitle:@"Contact Someone!" forState:UIControlStateNormal];
Upvotes: 5