当警报视图显示时,我想在文本字段中已有现有文本。这是我的代码,我必须添加什么?
UIAlertView* dialog = [[UIAlertView alloc] initWithTitle:@"Title" message:@"Message" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Add", nil];
[dialog setAlertViewStyle:UIAlertViewStylePlainTextInput];
// Change keyboard type
[[dialog textFieldAtIndex:0] setKeyboardType:UIKeyboardTypeDefault];
[dialog show];
最佳答案
UIAlertView* dialog = [[UIAlertView alloc] initWithTitle:@"Title" message:@"Message" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Add", nil];
[dialog setAlertViewStyle:UIAlertViewStylePlainTextInput];
[[dialog textFieldAtIndex:0] setKeyboardType:UIKeyboardTypeDefault];
[[dialog textFieldAtIndex:0]setText:@"Your string here"];
[dialog show];
关于ios - 将文本添加到Alertview文本字段iOS,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/22617098/