Objective c UIButton不显示标题标签

Objective c UIButton不显示标题标签,objective-c,Objective C,下面的代码基本上起作用,只有标题标签在显示结果时不显示 buttonRect只是一个包含按钮框架的CGRect。我认为问题的原因不在那里,因为按钮显示在他应该在的位置 [contactButton.titleLabel center]没有帮助,将子视图标题标签放在前面也没有帮助 UIButton *contactButton = [UIButton buttonWithType:UIButtonTypeRoundedRect]; contactButton.frame = buttonRect;

下面的代码基本上起作用,只有标题标签在显示结果时不显示

buttonRect
只是一个包含按钮框架的
CGRect
。我认为问题的原因不在那里,因为按钮显示在他应该在的位置

[contactButton.titleLabel center]
没有帮助,将子视图标题标签放在前面也没有帮助

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];
我真的不知道是什么导致了这一切

[myButton setTitle:@"Contact Someone!" forState:UIControlStateNormal];