我需要将 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];
此外,您还需要实现 UITextFieldDelegate
、UIAlertViewDelegate
协议(protocol)。
关于iphone - 将 TextField 添加到 UIAlertView,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9962538/