UITextField TapGesture doesn't respond on iOS 7.1 - ios

I have a uitextfield which is programatically added to view. I need to show a UIPickerview, when i tap on that, I have added a UITapgestureRecognizer for that and user interaction also enabled. Which was working fine till IOS 7.0. But when i updated to IOS 7.1 which is not getting called.

Rather than setting a tap gesture for your textField, you can simply set the inputView of your textField as your pickerView. This simply enables you to show the UIPicker when the textField is tapped or gains focus. Something like:
[YOUR_TEXTFIELD setInputView:YOUR_PICKER_VIEW];
This is just an alternative solution to your issue. You can give it a try.

Related

How to add long press functionality to a UITextField

I added a UILongPressGestureRecognizer to a UITextField only to find that the only thing that got triggered was the UITextField's magnifying glass; and then when the magnifying glass disappeared the context menu appeared.
What do I have to do in order for my UILongPressGestureRecognizer to be triggered instead of the default behavior?
I've already tried disabling all UILongPressGestureRecognizers before adding my own, as per some other SO answers, but to no avail.
Put a UIView on top of the textField with the same frame. Make it clear background. Add your gestures to your UIView and handle custom selections from there on. Make a tap gesture to start editing the text manually. And make a longpressgesture to do whatever you want. etc.

How to make iOS keyboard appear/stay up during entire app lifecycle?

I want to know how to make the keyboard appear in an iOS Swift app and remain there permanently. I know it appears when the user touches inside a textfield. That's not what I want. I want it to be there when the user loads up the app and to stay there permanently. I do still want the keyboard to communicate with a textfield as it normally would.
I would also like to be able to use the keyboard in storyboard auto layout and scale/align my buttons around the keyboard, which is asked here:
Xcode storyboard layout size simulation - keyboard up?
What I tried:
If I could simulate a "touch" inside a textfield programmatically I think I can accomplish my task. I would forcibly simulate a "touch" once the app loads and then in the "textFieldShouldReturn" method I can repeat the forced programmatic touch inside the textfield to prevent the keyboard from disappearing. (This may cause the keyboard to disappear and then reappear quickly, which would be ugly and undesirable.) How do I force this fake touch?
In Conclusion:
I am using iOS Storyboard and Swift.
How do I cause a keyboard to load up on start up and remain there even after pressing return/send?
If the above is impossible, how do I programattically force a touch inside a textfield?
I think that you can't do this from storyboard side, but from code side, assuming that you name your textfield "textField", you can do self.textField.becomeFirstResponder() on your viewDidLoad() in order to make the keyboard appear when you enter on this screen. This should keep the keyboard on screen unless you do resignFirstResponder() elsewhere.

Click a button to show the keyboard iOS

I want to realize the function: when I click a button, a interface of keyboard will come out in a dependent interface. How can I do it? Just for iOS.
You need to add to your current view UITextField with frame = CGRectZero, create a reference to that textField in code and then on pressing button call becomeFirstResponder on textField.
You need to add an UITextField to your view and call then [myTextfield becomeFirstResponder]; Its possible to set the hidden attrribute from UITextField to YES - so the user will never see the textfield. After Keyboard input is finished you can remove the UITextField with removeFromSuperview.
Maybe a little bit dirty,but thats the solution I used often. I wonder if the SDK provide another possibility.

iOS - Can I disable accessibility on cell.textLabel.text?

I have an app that contains a view with a cell that uses the built-in cell.textLabel and a custom UITextField in cell.contentView.
I am working with Voiceover and accessibility and the desired behavior would be that whenever I tap anywhere in the cell, the accessibility element for the UITextField would be selected.
The behavior that I am actually seeing is that the cell.textLabel accessibility labels are taking over. When I don't have cell.textLabel set to anything, everything works as expected. I have also attempted to set the "isAccessibilityElement" property with no luck:
[cell.textLabel.text setIsAccessibilityElement:NO];
Does anyone know how to make this work the way I want?
I was able to figure this out using this:
cell.textLabel.accessibilityElementsHidden = YES;

UiTextField's Touch Down Event on uitableviewcell doesn't work always

Ok I'm new on iOS, and I found out something really peculiar. I'm using a UITextField embedded in an UITableViewCell, and I'm trying that when I touch the textfield it shows an UIPopOverController with some options.
I was using the EditingDidBegin Event, it works fine, but when I try to touch twice the same textfield just works the first time, so I have to touch another textfield and touch again the first textfield.
So, I tried to change and to use TouchDown Event but I found that it does not always work correctly I have to touch several times the textfield and sometimes it never works, I don't know why, because when I use the same event in an textfield embedded in an UiView everythig works fine.
I don't know if I have to change something on the UiTableView or on the UITableViewCell, I'm using storyboard with xCode 4.2.
I would be great if someone can help me.
Along with EditingDidBegin do call resignFirstResponder on your textfield when you are done.
Now next time you tap the textfield it should work as expected.

Resources