2011-10-20 9 views
1

我有一個使用splitViewController的iPad應用程序。在我的RootViewController的 我添加按鈕編輯的產品清單,並添加爲什麼添加到我的導航項中的按鈕看起來不活動?

- (void)viewDidLoad 
{ 
    [super viewDidLoad]; 

    self.clearsSelectionOnViewWillAppear = NO; 
    self.contentSizeForViewInPopover = CGSizeMake(320.0, 500.0); 

    // Configure the Edit button 
    [[self navigationItem] setLeftBarButtonItem:[self editButtonItem]]; 

    // Configure the Add button 
    UIBarButtonItem * addButton = [[UIBarButtonItem alloc] 
            initWithBarButtonSystemItem:UIBarButtonSystemItemAdd 
            target:self 
            action:@selector(add)]; 



    [[self navigationItem] setRightBarButtonItem:addButton]; 
    [addButton release]; 

} 

它做工精細的新項目。按鈕點擊。調用選擇器。但按鈕看起來像是無效(灰色)。標題也是灰色的。爲什麼?

我需要做些什麼來給他們一個標準的佈局?

+0

哪個按鈕?編輯按鈕?或添加按鈕? – richerd

+0

同時編輯和添加標題。 –

+0

你可以截圖並附加到你的文章,我沒有看到你的代碼有什麼問題。 – richerd

回答

0

可以是這是此line.Comment此線

self.clearsSelectionOnViewWillAppear = NO;

+0

不,它沒有幫助。 –

0

從屏幕截圖中,BarButtonItems的顏色是UISplitViewController的正確和默認顏色。

如果你想自定義BarButtonItems的顏色,你可以通過提供一個tintColor來修改顏色的按鈕。

addButton.tintColor = [UIColor redColor]; 
相關問題