2013-04-18 72 views
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"; 

回答

1

使新標籤的框架變大。導航欄的高度固定爲44像素。

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

寬度和原點取決於導航欄上的其他內容以及導航欄的寬度。