2011-08-18 56 views
2

這是代碼,這將顯示默認大小,我想改變標題的字體大小becoz這個標題太大n沒有顯示整個「庫克大印度...」顯示... pl讓我幫忙如何更改iPhone中的標題字體大小?

- (void)viewDidLoad { 

    self.title = @"Cook Great Indian Recipes"; 
} 
+0

從廈門國際銀行的屬性檢查器,可以eaisly實現它。 – rptwsthi

回答

3

您不能更改title的字體。請改爲使用您自己的自定義創建UILabel,並將其指定爲navigationItem的titleView

UILabel *titleLbl = [[UILabel alloc] init]; 
label.frame = CGRectMake(... 
label.font = [UIFont ... 
// And the other things 
self.navigationItem.titleView = titleLbl; 
[titleLbl release]; 
+0

thnx爲你的迴應bt這是行不通的... –

11

嘗試設置的自定義標籤標題標籤:

self.title = @"Cook Great Indian Recipes"; 
    CGRect frame = CGRectMake(0, 0, [self.title sizeWithFont:[UIFont boldSystemFontOfSize:20.0]].width, 44); 
    UILabel *label = [[UILabel alloc] initWithFrame:frame]; 
    label.backgroundColor = [UIColor clearColor]; 
    label.font = [UIFont boldSystemFontOfSize:17.0]; 
    label.textAlignment = UITextAlignmentCenter; 
    self.navigationItem.titleView = label; 
    label.text = self.title; 
    [label release]; 
+0

thnx夥計這是工作perfactly.1.1c再次thnx給予例如.. –

相關問題