我正在尝试在导航栏的右侧添加自定义导航栏按钮。
这是我的代码。
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;
但我仍无法看到我页面上的按钮..
答案 0 :(得分:0)
我忘了添加标题颜色..
这就是为什么默认它将白色作为文本颜色
感谢您的回复。