0

我有一个 UICollectionViewController 并试图设置导航标题..但这些都不起作用......它不显示文本!

self.titleLabel = [[UILabel alloc] initWithFrame:CGRectZero];
self.titleLabel.backgroundColor = [UIColor clearColor];
self.titleLabel.font = [UIFont fontWithName:@"ArialHebrew-Bold" size:15];
self.titleLabel.shadowColor = [UIColor colorWithWhite:0.0 alpha:0.5];
self.titleLabel.textAlignment = NSTextAlignmentCenter;
self.titleLabel.textColor = [UIColor whiteColor];
self.titleLabel.text = [self.navigationItem title];
self.navigationItem.titleView = self.titleLabel;
[self.titleLabel setText:@"title"];

self.navigationItem.title = @"The title";
4

1 回答 1

1

使新标签的框架更大。导航栏的高度固定为 44 像素。

例如:CGRectMake(100,0,120,44);

宽度和原点取决于导航栏上的其他内容以及导航栏的宽度。

于 2013-04-18T01:38:32.550 回答