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 に答える