我正在尝试在导航栏的右侧添加自定义导航栏按钮。
这是我的代码。
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;
但我仍然看不到我页面上的按钮..