UIAextField在UIAlertView中的替代方案?

0xS*_*ina 1 cocoa-touch objective-c ios

我想要用户快速输入.我知道我可以在UIAlertView中放置一个UITextField但它有点像"黑客".是否有官方/替代方式来做到这一点?

令人惊讶的是,对这种典型情况无法控制.

谢谢

更新:尝试了EGOTextFieldAlertView,但结果如下: 在此输入图像描述

和代码:

   EGOTextFieldAlertView *alert = [[EGOTextFieldAlertView alloc] initWithTitle:@"Enter the group name" 
                                                                        message:nil 
                                                                       delegate:self 
                                                              cancelButtonTitle:@"Cancel" 
                                                              otherButtonTitles:@"OK", nil];
    [alert addTextFieldWithLabel:@"Name"];
    [alert show];
    [alert release];
Run Code Online (Sandbox Code Playgroud)

Lil*_*ard 5

如果你愿意要求iOS 5那么它就不再是黑客了.UIAlertView现在有一个alertViewStyle属性,当设置为时UIAlertViewStylePlainTextInput,会向您可以检索的警报添加单个文本字段-[UIAlertView textFieldAtIndex:].

如果你仍然需要4.3或更早,那么不,没有正式的方法来做到这一点,它确实是一个与调用SPI相当的大"黑客".