我已经检查了其他类似的问题,并完成了那些内容,我认为,但是我的自定义字体仍然没有显示在UI按钮上。UIButton自定义字体没有显示
字体在项目中,并且它在我的UITableViewCells中正确显示,所以我知道该字体工作正常。
我加载视图,并将字体分配给按钮,但是当我运行该应用程序时,它没有显示正确的字体。
FirstViewController.h
@interface FirstViewController : UIViewController <UITextFieldDelegate, UITableViewDelegate, UITableViewDataSource> {
...
UIButton *searchButton;
...
}
...
@property (nonatomic, retain) IBOutlet UIButton *searchButton;
...
@end
然后我在FirstViewController.m
@synthesize searchButton;
- (void)viewDidLoad
{
[super viewDidLoad];
self.searchButton.titleLabel.font = [UIFont fontWithName: @"FontFile" size: 11.0 ];
}
得到这个我做了什么错?
确保searchButton连接IB。 – jamihash
检查您的searchButton属性是否在接口文件中连接。 –
是否正确单击,然后将引用出口拖动到文件的所有者,然后从弹出窗口中选择“searchButton”?在IB –