警告:'UIAlertView'可能无法响应'-addTextFieldWithValue:label:' [英] warning: 'UIAlertView' may not respond to '-addTextFieldWithValue:label:'
本文介绍了警告:'UIAlertView'可能无法响应'-addTextFieldWithValue:label:'的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在我的应用程序中我使用UIAlertView进行登录,它包含TextFields,它工作得很好,但是当我编译代码时我收到警告,我正在使用iphone SDK 3.0
in my application i was using UIAlertView for login, it contains TextFields, its working perfectly, but i'm getting a warning when i compile the code, i'm using iphone SDK 3.0
代码:
loginAlert = [[UIAlertView alloc] initWithTitle:@"Enter the User Name and Password" message:@"" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"Login", nil];
[loginAlert addTextFieldWithValue:appDelegate.userName label:@"UserName"];
警告:'UIAlertView'可能无法响应'-addTextFieldWithValue:label:'
warning: 'UIAlertView' may not respond to '-addTextFieldWithValue:label:'
txfUserName = [loginAlert textFieldAtIndex:0];
警告:'UIAlertView'可能无法响应'-textFieldAtIndex:'
warning: 'UIAlertView' may not respond to '-textFieldAtIndex:'
推荐答案
UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle:@"Your title here!" message:@"this gets covered" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil];
UITextField *myTextField = [[UITextField alloc] initWithFrame:CGRectMake(12.0, 45.0, 260.0, 25.0)];
[myTextField setBackgroundColor:[UIColor whiteColor]];
[myAlertView addSubview:testTextField];
CGAffineTransform myTransform = CGAffineTransformMakeTranslation(0.0, 130.0);
[myAlertView setTransform:myTransform];
[myAlertView show];
[myAlertView release];
所有积分: http://www.iphonedevsdk.com/forum/iphone-sdk-development/1704-uitextfield-inside-uialertview.html
这篇关于警告:'UIAlertView'可能无法响应'-addTextFieldWithValue:label:'的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文