Unable to add UITextField to UIAlertView on iOS7…works in iOS 6

后端 未结 7 1518
梦毁少年i
梦毁少年i 2020-12-01 01:34

The code below works on iOS6 (and before) but the UITextField does not display in iOS7...any ideas on how to get a UITextField to display in an UIAlterView in iOS7?

7条回答
  •  没有蜡笔的小新
    2020-12-01 01:41

    You can't easily alter the view hierarchy of a UIAlertView in iOS 7. (Nor should you; the documentation specifically tells you not to.) Head over to the developer forums to see a long discussion about it.

    One alternative in your case is to set alert.alertViewStyle = UIAlertViewStylePlainTextInput; This will add a text field for you. You can access it in the UIAlertView delegate callback by using UITextField *textField = [alertView textFieldAtIndex:0];.

提交回复
热议问题