UIAlertView *alert = ......
UIView *customView = ....
UITextField *textField = ......
textField.text = @"Enter Name";
[customView addSubview: textField];
[alert setValue: alertView forKey:@"accessoryView"];
[alert show];
self.string = textField.text;
字符串@「輸入名稱」被保存到self.string中,而不是用戶輸入的文本字段。 我有三個textFields,所以我不能使用uialert的用戶名/密碼從UIAlert內部的自定義視圖保存UITextField文本
嘗試給所有UITextFields一個唯一標記,以便通過詢問viewWithTag知道哪個標記: – Jasper 2014-08-27 15:05:20