Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/27.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone 如何从UIAlertView获取输入?_Iphone_Objective C_Cocoa_Uikit - Fatal编程技术网

Iphone 如何从UIAlertView获取输入?

Iphone 如何从UIAlertView获取输入?,iphone,objective-c,cocoa,uikit,Iphone,Objective C,Cocoa,Uikit,我想使用UIAlertView将玩家名称作为输入。是否可以在UIAlertView上添加textField 是的,但不是没有一些黑客,看到这个了吗 您必须直接操作UIAlertView的子视图,添加UIExtField,然后调整UIAlertView框架的大小。您最好创建自己的视图。是的,这绝对是可能的,而且不是一种黑客行为。您需要将UIAlertView子类化并将控件放入其中。因为它是一个子类,所以它将保留相同的外观和感觉等 有关详细信息,请参见Jeff LaMarche(从Apress开始i

我想使用UIAlertView将玩家名称作为输入。是否可以在UIAlertView上添加textField

是的,但不是没有一些黑客,看到这个了吗
您必须直接操作UIAlertView的子视图,添加UIExtField,然后调整UIAlertView框架的大小。您最好创建自己的视图。

是的,这绝对是可能的,而且不是一种黑客行为。您需要将UIAlertView子类化并将控件放入其中。因为它是一个子类,所以它将保留相同的外观和感觉等


有关详细信息,请参见Jeff LaMarche(从Apress开始iPhone开发的合著者)。

自iOS 5以来,UIAlertView提供以下功能:将alertViewStyle属性更改为以下内容之一:

UIAlertViewStylePlainTextInput (1 text field)
UIAlertViewStyleSecureTextInput (1 password field)
UIAlertViewStyleLoginAndPasswordInput (both a text field and password field)
然后使用
textfieldatinex:
获取所需的文本字段。这样,您甚至可以使用
alertViewShouldEnableFirstOtherButton:
delegate方法来启用该按钮