我和我的好友正在開發一款應用程序,我們都是新手,但已經有很長的路要走。在alertView語句中調用IBaction
我們現在被困在這件事上。我們有一堆texfields,通過這個動作,我們有清楚的按鈕鏈接到它,但是,如果您在其中一個警報視圖按鈕上單擊「是」,我們希望該動作被調用。
- (IBAction)clearText:(id)sender {
Spelare1Slag1.text = @"";
Spelare1Slag2.text = @"";
}
我們也有這樣的警報視圖:
alertDialog = [[UIAlertView alloc]
initWithTitle: @"Warning"
message: @"Do you want to delete?"
delegate: self
cancelButtonTitle: @"No"
otherButtonTitles: @"Yes", nil];
- (void)alertView: (UIAlertView *)alertView
clickedButtonAtIndex:(NSInteger)buttonIndex {
NSString *buttonTitle=[alertView buttonTitleAtIndex:buttonIndex];
if ([buttonTitle isEqualToString:@"No"]) {
}
else if ([buttonTitle isEqualToString:@"Yes"]){
Spelare1Slag1.text = @"";
}
}
因此,這是我們認爲我們應該這樣做,但我們不知道該怎麼放在else if語句中。當您在警報視圖中按下「是」按鈕時,我們希望文本框清除,而不是在按「否」時不清除。
在此先感謝!
這看起來很有希望,明天我會看着它,我不在家atm! – Laymachine 2013-02-14 15:15:42
解決了它,謝謝! – Laymachine 2013-02-15 21:37:50