首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Alertview警告

Alertview警告
EN

Stack Overflow用户
提问于 2011-05-19 07:53:24
回答 4查看 873关注 0票数 1

可能重复:

warning: 'UIAlertView' may not respond to '-addTextFieldWithValue:label:'

我在AlertView中为put textfield使用下面的代码,它给出了一个警告,比如"UIAlertView可能不会响应- addTextFieldWithValue: label:“& "UIAlertView可能不会响应-textFieldAtIndex”。

代码语言:javascript
复制
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];

请帮帮忙!

EN

回答 4

Stack Overflow用户

回答已采纳

发布于 2011-05-19 07:58:37

没有用于uialertview的"addTextFieldWithValue“方法。

如果您需要修改您的警报视图,请查看我的博客- http://www.makebetterthings.com/blogs/iphone/add-uitextfield-in-uialertview/

票数 0
EN

Stack Overflow用户

发布于 2011-05-19 07:56:38

这些方法不像addTextFieldWithValue in UIAlertView那样。

票数 0
EN

Stack Overflow用户

发布于 2011-05-19 07:59:32

[alert addTextFieldWithValue:@"" label:@"Email"];是一个私有api。我的应用程序因为使用这个而被拒绝了。

使用这个

代码语言:javascript
复制
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];
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/6055493

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档