2010-01-12 47 views
0

問題,啓用按鈕

有一個UIButton,我可以這樣做:

myButton.enabled = YES; 
     or 
myButton.enabled = NO; 

但是,我不能做一個的UIBarButtonItem相同的(導航欄按鈕)

所以,我該如何阻止用戶點擊它?

+0

阿爾法也不起作用。 – 2010-01-12 10:04:09

回答

1

當然可以;一個UIBarButtonItem是UIBarItem的一個子類,它有一個啓用的屬性。只要使用它。

剛剛獲得該項目的引用,你有什麼上面:

UIBarButtonItem *item = self.navigationItem.rightBarButtonItem; 

item.enabled = NO; 
+0

我該怎麼做?我似乎無法弄清楚......:S – 2010-01-13 00:30:57

+0

呵呵。我試過了。 以及它昨晚沒有工作,但它現在有效。奇。 Cheers Ben。 – 2010-01-13 03:57:54