0

我正在尝试在导航栏的右侧添加自定义导航栏按钮。

这是我的代码。

UIButton *customPrintButton = [UIButton buttonWithType:UIButtonTypeCustom];
[customPrintButton setFrame:CGRectMake(0, 0, 100, 30)];
[customPrintButton.titleLabel setTextColor:[appDelegate getAppPinkColor]];
[customPrintButton setTitle:@"Print" forState:UIControlStateNormal];
[customPrintButton setBackgroundColor:[UIColor clearColor]];
[customPrintButton setExclusiveTouch:YES];
[customPrintButton.titleLabel setTextAlignment:NSTextAlignmentCenter];
[customPrintButton.titleLabel setFont:[UIFont systemFontOfSize:20]];
[customPrintButton addTarget:self action:@selector(printOutButton_Clicked) forControlEvents:UIControlEventTouchUpInside];

printOutBtn = [[UIBarButtonItem alloc]initWithCustomView:customPrintButton];
self.navigationItem.rightBarButtonItem = printOutBtn;

但我仍然看不到我页面上的按钮..

4

1 回答 1

0

我忘了添加标题颜色..

这就是为什么默认它采用白色作为文本颜色

谢谢您的回复。

于 2014-08-22T04:36:14.247 回答