I am trying to show UIAlertView on Tap or Click of UITextField for both IPad and IPhone. I make an IBAction and Attach it with Tap Down event of UITextField.
But its not working correctly, means not always, in case of iphone and not working in-case of iPad
- (IBAction) TopuchState
{
//function code
}
please help How could I do this.
Connect TextField with delegate and Now calling this function!!
In Swift 3
Add a target for a particular text field for the event .editingDidBegin in viewDidLoad method
I think it's easier if you set the delegate for the
UITextField
and implement the method:then inside that method you can easily create and show your
UIAlertView
.Take a look at UITextFieldDelegate.
Good luck!
As you are already subscribed to be UITextField delegate, implement this method:
Try adding a target for when a particular text field begins editing (
UIControlEventEditingDidBegin
):