将TextField添加到UIAlertView [英] Adding TextField to UIAlertView

查看:111
本文介绍了将TextField添加到UIAlertView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我需要向 UIAlertView 添加 TextField 。我知道苹果阻止这种方法。所以有任何库,我可以使用添加 TextField UIAlertView 看起来像帧吗? / p>

I need to add a TextField to an UIAlertView. I understand that apple discourage this approach. So is there any library that i could make use of to add a TextField to a UIAlertView look-alike frame ?

推荐答案

对于iOS5:

UIAlertView *av = [[UIAlertView alloc]initWithTitle:@"Title" message:@"Please enter someth" delegate:self cancelButtonTitle:@"Cancel" otherButtonTitles:@"OK", nil];
av.alertViewStyle = UIAlertViewStylePlainTextInput;
[av textFieldAtIndex:0].delegate = self;
[av show];

此外,您还需要实现 UITextFieldDelegate UIAlertViewDelegate 协议。

Also, you 'll need to implement UITextFieldDelegate, UIAlertViewDelegate protocols.

这篇关于将TextField添加到UIAlertView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆