iphone - 将 TextField 添加到 UIAlertView

标签 iphone objective-c ios cocoa-touch

我需要将 TextField 添加到 UIAlertView。我知道苹果不鼓励这种方法。那么是否有任何库可以用来将 TextField 添加到 UIAlertView 相似的框架?

最佳答案

对于 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];

此外,您还需要实现 UITextFieldDelegateUIAlertViewDelegate 协议(protocol)。

关于iphone - 将 TextField 添加到 UIAlertView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9962538/

相关文章:

ios - 在 Swift 中通过 TCP 发送消息

iphone - 如何将 UIImage 和 UILabel 水平居中在一起?

objective-c - 用于 objective-c 的jGraphT?

ios - Firestore 查询在创建新文档时未收到更新

ios - 我想在不重新启动应用程序的情况下更改应用程序的语言

iphone - 如何从命令行运行 UIAutomation 脚本到模拟器

android - 是否可以在iphone开发的android中读取序列化数据

objective-c - 构建时出现多个构建命令警告-Objective C

iphone - 选择时更改按钮文本颜色

Android opentok 视频聊天 android 到 ios 问题