0
我想重播一個帶textfield的alertView,直到它被取消。文本字段中的文本應保存在NSMutableArray
中。我嘗試了一些,但它不起作用。它會由myNSMutableArray = ...
EXPECTED標識符表示。我究竟做錯了什麼?UIAlertView保存textfield.tex
@synthesize myNSMutableArray;
- (void)viewDidLoad {
[super viewDidLoad];
[self alert];
}
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex: (NSInteger)buttonIndex {
if (buttonIndex == 0) {
myNSMutableArray = [[NSMutableArray alloc] addObject:[[alertView textFieldAtIndex:0].text]];
[self alert];
}
else{
NSLog(@"Done");
}
}
-(void)alert{
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Titel" message:@"Message" delegate:self cancelButtonTitle:@"Next" otherButtonTitles:@"Done", nil];
alert.alertViewStyle = UIAlertViewStylePlainTextInput;
[[alert textFieldAtIndex:0] setPlaceholder:@"First"];
[alert show];
}
謝謝。我很感激。 – Nanog000