如何实现 ios 7 的 textfieldname.text 和 textfield.placeholder 功能?我使用了以下代码。
UIAlertView* dialog = [[UIAlertView alloc] init];
[dialog setDelegate:self];
[dialog setTitle:@"Title"];
[dialog setMessage:@" "];
[dialog addButtonWithTitle:@"OK"];
[dialog addButtonWithTitle:@"Cancel"];
[dialog setAlertViewStyle:UIAlertViewStylePlainTextInput];
[dialog show];
有时我想将一些数据加载到文本字段中,例如如果用户需要将“欢迎”加载到文本字段中,然后他们可以将测试修改为“欢迎使用 stackoverflow”。是否有可能实现该功能?提前感谢您的帮助。
最佳答案
UITextField *textField = [dialog textFieldAtIndex:0];
textField.text = @"Some Text";
textField.placeholder = @"Some Placeholder";
关于ios - 如何使用 UIAlertViewStylePlainTextInput 在 ios 7 中使用 textfieldname.text 和 textfield.placeholder?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22879497/