在aletview中顯示三個文本字段時出現錯誤。請幫忙。UIAlertView中的多個文本字段
self.alert = [[CustomAlertView alloc] initWithTitle:@"My Alert" message:@"Please enter information." delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Ok", nil];
[self.alert setAlertViewStyle:UIAlertViewStylePlainTextInput];
UITextField *firstTextField = [self.alert textFieldAtIndex:0];
[firstTextField setKeyboardType:UIKeyboardTypeNumberPad];
UITextField *secondTextField = [self.alert textFieldAtIndex:1];
[secondTextField setKeyboardType:UIKeyboardTypeNumberPad];
UITextField *thirdTextField = [self.alert textFieldAtIndex:2];
[thirdTextField setKeyboardType:UIKeyboardTypeNumberPad];
[self.alert setTag:1];
[self.alert show];
可以通過提供錯誤來闡述。 – rckoenes
***終止應用程序由於未捕獲的異常「NSInvalidArgumentException」,原因:'textFieldIndex(1)超出了文本字段數組邊界' – user3491942