editing is disabled in UITextfield in a static TableView - iOS 6.0 only - iphone

I have two UITextFields inside a static TableView (in a Storyboard) for loggin in. The first time go to the tableView via a modal segue, the TextFields are editable as they should be. When I then go back and forth to that view again, the TextField seem to be non-editable. If I read out the textField.isEnabled, it is set to YES.
Even more strange: this behavior is only with iOS 6.0. On iOS 5.0 everything is fine.
I've already added this in viewWillAppear
TextField.userInteractionEnabled = YES;
I've also commented out all of my viewDidLoad and viewWillAppearCode, but still no avail.
Any idea is welcome.
EDIT: after closing and restarting the app, I once again have one shot. I looks like something is screwed, once I opened and closed the view.

I actually had a very similar problem with my TextFields in one view not being editable after doing a back and forth segue with another view. For me, it was a problem with the first responder status, and things started working fine after adding the following in prepareForSegue:
[self.textFieldName1 resignFirstResponder];
Hope that helps.

Related

Some UITextfields don't respond in iOs6

Since updating to iOS 6 I have this weirdest bug when trying to make an UITextField or UITextView firstResponder.
...it doesn't work.
I am not able to select the field or view and bring up the keyboard, nor is there a cursor or anything.
The weirdest thing is that it is only not working for SOME fields, other ones in different viewcontrollers work without trouble.
I have:
[self.window makeKeyAndVisible];
self.window.rootViewController = self.viewController;
in my appDelegate.
It worked and still works without problems with iOS 5.
Any ideas on what it could be?
Thanks!
I found out what was causing the problem.
From the viewcontroller I present the new viewcontroller from a textfield was firstResponder. So when I cancel this by calling
[textview resignFirstResponder];
or
[self.view endEditing:YES];
BEFORE presenting the new viewcontroller, it works without problems.
Question remains.... Why is this? And is there a better way to overcome this? I don't feel much for resigning every textfield throughout my app...
I know this post is old, but if it help, in iOS6 yo also need to resign the responder in the "granparents" views.
Ex:
Search View (don't resign responder) -> Detail View -> Super Detail View (This one have the problem).
Detail View dont have first reponder, but Search View has it.
We have to resign the responder in Search view to solve the problem in Super Detail View.
I assume that we also have to resign responder in the previws controllers of Search View.

popViewController / viewWillAppear not animated in iOS 5

I wasn't lucky with searching for this, so here we go ;)
I have a UIViewController with a custom UINavigationBar which pushes another UIViewController as subview.
Everything works fine except when I click the back button on the subview. The previews (first) view appears correctly, but not animated. The animation of the UINavigationBar is correct, only the views switch immediately.
The function - (void)viewWillAppear:(BOOL)animated of the first UIViewController gets called with NO for animated. This only happens when I test with iOS 5, not with iOS 4.
Does anyone know how to fix this?
Thanks for your help! Hannes
UPDATE 1
I just removed all custom code and just used the plain UINavigationBar (so no extra settings) and it still doesn't work with iOS 5. This is my code I use in the first ViewController to push the second ViewController:
[self.navigationController pushViewController:secondViewController animated:YES];
As I already mentioned - when I click the back button in the navigation bar on the second view the first view appears immediately without animation.
Any help would be appreciated! Thanks!
UPDATE 2
I feel like I'm getting closer to the issue, but still no solution:
I just added a custom UINavigationController where I just call [super popViewControllerAnimated:animated]. This get's called correctly (animated is YES) but the viewWillAppear of the first UIViewController gets NO as value for animated...
I was having a similar problem today where the UIViewController was getting NO in viewWillAppear, except with the standard UINavigationBar and UINavigationController.
It turned out to be due to manually calling viewWillAppear:YES somewhere it shouldn't have been. This item suggests that it can also be caused by calling the wrong super method somewhere (e.g. [super viewWillAppear:animated] instead of [super viewDidAppear:animated] inside of viewDidAppear).
As for using a custom UINavigationBar, I ran across this link today that may help your case: http://sloshire1.posterous.com/simple-fix-for-viewwillappear-in-ios5
Apple implemented official ways to create custom navigation bars in iOS 5. Unfortunately, they also broke most of the non-official ways of doing it in iOS 4. iOS 5 won't call drawRect for you anymore. You need to have two ways of doing it, one for iOS 5 and greater, using the new calls, and one for iOS 4 and earlier, using the old calls. Check out the documentation for custom navigation bars in iOS 5 for more info.
Did you try to remove all your custom code and go with the native navigation bar? Does the behavior stay the same? This way you can check if your custom bar messes with the transition.

UISearchaBar is disappearing from UITableView

I've a view controller (named it as SearchViewController) with UITableView and UISearchBar. UISearchBar is set to table as a header view. While searching in the table using this searchbar works great.
By selecting any one of the displayed search results, I can move to next view (named it as DetailsViewController). But after returning to the SearchViewController, magically the UISearchBar is disappeared and my app is crashed. I found the same code is working fine on iOS 3.1.2 but not on iOS 4.0 (no idea about 4.0.1 or 4.0.2).
I'll be really thankful, if anyone has a work around for this.
I always use an UINavigationBar and an UINavigationItem to display the UISearchBar. Setting the navigationItem.titleView to the searchBar works fine for me. (Don't forget to call [theSearchBar sizeToFit])
Please give us more information on the crash. What is the console output?

UITextField keyboard doesn't appear

I have a very simple screen with an UITextField with the default configuration, nothing special.
When I touch the UITextField, the keyboard doesn't pops up.
I haven't any custom control, behavior or anything else, just that, but it doesnt'work.
I've done this in previous apps iPhone/iPad apps already on the AppStore but i can't figure out what's going wrong here.
The UITextField is created in Interface Builder, in the nib file.
I've been doing some research and i added an IBAction in the UIViewController for UItextField TouchDown event and the IBOutlet for the UITexField.
In the first line of the code i added:
[textFild becomeFirstResponder];
That's the default behavior of the UITextField, when you touch it, it becomes the first responder asking the system to show the keyboard.
I debugged it and it runs that line, but the keyboard still doesn't shows up.
Thanks in advance.
Many times your code is right, it's just about the settings of your Xcode or the Simulator.
Try Toggling Keyboard Software in the Simulator
Simulator --> Hardware --> Keyboard --> Toggle Software Keyboard
OR just simply hit Command + K it would do the same thing
One thing you should check is to make sure the containing view (the UIView that contains all the controls), which is the View icon in Interface Builder nib viewer, has User Interaction Enabled checked. If the parent container doesn't have this checked, even if the individual controls do, you will see this behavior.
I already figured out by myself!
I had tha UITextField in a UIViewController that gets presented from another view controller
who responds to motion events, and that previous View Controller was allways the First Responder.
All I had to do was everytime i leave the controller's view in viewWillDisappear:(BOOL)animated, i called [self resignFirstResponder]; and that was all.
I took me a while to find this silly oversight, but make sure that both properties of UITextView: selectable and editable are set to true.
Its a pretty basic thing but make sure your USER INTERACTION and ENABLED are checked in the storyboard editor.

Only showing View after second Push on iPhone

I'm having an annoying problem, that may have a simple answer!
I have a ViewController (which contains a TableView Controller and Header View) which I am pushing on to a Navigation Controller - When I push it on the first time after launching, I get a blank view. When I click the Back button to pop it, it appears fine from then on until I re-launch the app.
Does anyone know an "obvious" reason why this would happen?
BTW- following the code in Debug, it appears to be doing all the correct things.. loading the ViewController variables if nil, etc. before the first view.
Thanks!
did you reload the table after data are loaded ?
[tableView reloadData];