可能重复:
warning: 'UIAlertView' may not respond to '-addTextFieldWithValue:label:'
我在AlertView中为put textfield使用下面的代码,它给出了一个警告,比如"UIAlertView可能不会响应- addTextFieldWithValue: label:“& "UIAlertView可能不会响应-textFieldAtIndex”。
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"Email" message:@""
delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Submit", nil];
[alert addTextFieldWithValue:@"" label:@"Email"];
// Username
textfieldName = [alert textFieldAtIndex:0];
textfieldName.keyboardType = UIKeyboardTypeEmailAddress;
textfieldName.keyboardAppearance = UIKeyboardAppearanceAlert;
textfieldName.autocorrectionType = UITextAutocorrectionTypeNo;
[alert show];请帮帮忙!
发布于 2011-05-19 07:58:37
没有用于uialertview的"addTextFieldWithValue“方法。
如果您需要修改您的警报视图,请查看我的博客- http://www.makebetterthings.com/blogs/iphone/add-uitextfield-in-uialertview/
发布于 2011-05-19 07:56:38
这些方法不像addTextFieldWithValue in UIAlertView那样。
发布于 2011-05-19 07:59:32
[alert addTextFieldWithValue:@"" label:@"Email"];是一个私有api。我的应用程序因为使用这个而被拒绝了。
使用这个
UIAlertView *myAlert = [[UIAlertView alloc] initWithTitle:@"Twitter"
message:@"\n\n\n\n"
delegate:self
cancelButtonTitle:@""
otherButtonTitles:@"", nil];
myAlert.frame = CGRectMake( 0, 0, 300, 260);
textfieldName = [[UITextField alloc] initWithFrame:CGRectMake(13, 95, 260, 25.0)];
[textfieldName setBackgroundColor:[UIColor whiteColor]];
textfieldName.placeholder = @"xyz";
textfieldName.keyboardType = UIKeyboardTypeAlphabet;
textfieldName.keyboardAppearance = UIKeyboardAppearanceAlert;
textfieldName.autocorrectionType = UITextAutocorrectionTypeNo;
textfieldName.delegate = self;
textfieldName.tag = 1;
[myAlert addSubview:textfieldName];https://stackoverflow.com/questions/6055493
复制相似问题