how to get input from UIAlertView?
I want take player name as input by using UIAlertView. Is it possible to add textField on the UIAlertView?
3 Solutions Collect From Internet About “how to get input from UIAlertView?”
Yes, it’s definitely possible, and it isn’t a hack. You would need to subclass UIAlertView and place controls into it. Since it’s a subclass, it will retain the same look & feel, etc.
For full details, see this tutorial by Jeff LaMarche (co-author of Beginning iPhone Development, from Apress).
Since iOS 5, UIAlertView provides this: change the alertViewStyle property to one of the following:
UIAlertViewStylePlainTextInput (1 text field) UIAlertViewStyleSecureTextInput (1 password field) UIAlertViewStyleLoginAndPasswordInput (both a text field and password field)
textFieldAtIndex: to get the text field you want. This way, you can even use the
alertViewShouldEnableFirstOtherButton: delegate method to enable the button.
Yes, but not without some hacking, see this previous question.
You’d have to directly manipulate the UIAlertView’s subviews and add a UITextField and then resize the UIAlertView’s frame. You’re better off creating your own view.
- UISwitch in a UITableView cell
- CCCrypt decrypting in AES CBC works even without IV
- String to Int in Swift 3.0
- Star micronics mpop iOS SDK – Save and print a character using the blank code page
- How to use NSArrayController to fill data in NSTableView
- Objective-C: Are all string literals always loaded into memory?
- Changing language on the fly in swift
- Enabling core data lightweight migration in Swift 3
- Purpose of @ Symbol Before Strings?
- Checking a null value from Json response in Objective-C
- Physics bodies other than my player won't call didBeginContact when colliding
- How to tap to zoom and double tap to zoom out in iOS?
- Recognizing multiple UILabels tap for UITapGestureRecogniser
- How to Mask an UIImageView
- iphone: secure restfull server “The certificate for this server is invalid