2010-10-21 77 views
0

有人知道聯繫人應用程序中的非活動完成按鈕是如何完成的嗎?不活動的UIBarButtonItem

我想實現類似的東西。

到目前爲止,我還沒有看到任何的UIBarButtonItem不活躍財產......

回答

2

使用enabled財產。當然,您需要對視圖控制器中的輸入控件使用自己的驗證檢查,以確定是否將其設置爲啓用。

// Assuming the Done button is on the right 
[self.navigationItem.rightBarButtonItem setEnabled:NO]; // Disables the button 

The enabled property is found in UIBarItem,類從中繼承UIBarButtonItem,這就是爲什麼你會不會在UIBarButtonItem文檔中找到它。