13
的方法我有一個方法hideButton執行:@selector使用具有參數
-(void) hideButton:(UIButton) *button {
[button setHidden:YES];
}
和我得到一個「不能使用一個對象作爲參數的方法」的錯誤。
我想調用這個
[self performSelector:@selector(hideButton:smallestMonster1)
withObject:nil afterDelay:1.0];
如何才能做到這一點時,可以給該按鈕作爲參數的方法?因爲上述嘗試不起作用。我需要能夠將按鈕作爲參數,或者至少讓該方法知道1秒後隱藏了哪個按鈕被調用。
感謝
謝謝。 hideButton方法如何設置將對象作爲參數?如果我嘗試上述,我得到不能使用對象作爲參數錯誤/ – jarryd 2010-07-25 12:03:33
不清楚是什麼問題... hideButton方法定義是好的,它應該用我的答案正確調用...在第一個參數performSelector - 你提供選擇器簽名,用withObject - 作爲參數傳遞給選擇器的對象。 – Vladimir 2010-07-25 12:14:43
無論哪種方式,如果我嘗試hideButton(UIButton)按鈕,我得到一個錯誤,如果我嘗試hideButton(UIButton)*按鈕,我得到一個錯誤。我嘗試使用(ID),但應用程序崩潰與無法識別的選擇器發送到實例錯誤。 – jarryd 2010-07-25 12:25:09