UITextField in UIAlertView alternative?

前端 未结 4 464
逝去的感伤
逝去的感伤 2021-01-15 21:56

I want a quick input from a user. I know I can put a UITextField in UIAlertView but it\'s sort of a \"hack\". Is there an official/alternative way to do this?

It\'s

4条回答
  •  天命终不由人
    2021-01-15 22:18

    If you're willing to require iOS 5 then it's no longer a hack. UIAlertView now has a alertViewStyle property which, when set to UIAlertViewStylePlainTextInput, adds a single text field to the alert that you can retrieve with -[UIAlertView textFieldAtIndex:].

    If you still require 4.3 or earlier, then no, there's no official way to do this and it really is a big "hack" that's on par with calling SPI.

提交回复
热议问题