I have a UISearchBar which is an IBOutlet. Tapping on the search bar or calling [searchBar becomeFirstResponder] in viewDidAppear results in a few seconds delay where the UI is locked before the keyboard appears.
I've looked at this in Instruments, and there is a CPU usage spike when becomeFirstResponder is called, but I'm not sure how I can narrow this down to a method / bunch of methods within the spike.
The view controller is not doing anything blocking, and there is nothing else running on the main thread (as far as I can see). This only happens the first time after calling becomeFirstResponder or tapping on the search bar. It does not happen again once the keyboard has been dismissed.
Any help would be much appreciated, as I can't see what's wrong really.
This is all running on iOS7, on iPhone and iPad BTW.
Related
I have noticed a problem with the navigation in our app.
Back buttons on UINavigationController for dismiss a viewController, or ok button for dismiss keyboard not reacting on tap each time. I have to press several times to finally enter in the button action method.
But i can see the button hilighting on each tap.
My viewControllers are pushed/presented and dismiss from the main thread.
My viewControllers is pushed/presented once.
There is no hidden view who catch the tap.
In the memory graph, I have no viewController instance leacked.
In the instrument I Have no CPU hight usage, No network call in progress.
App is in swift and uses rxSwift.
We don't use segue, all screens are pushed programmatically.
Has anyone ever encountered this problem ?
Have you something for me to check, explore or some advices ?
I have resolved my problem. It was caused by an override of isEnable method in a UIButton extension for my buttons.
I had changed the isUserInterrationEnable accordingly to isEnable.
Back button in navigation controller and ok button in keyboard InputAccessoryView are also UIButtons.
So my extension makes conflict with the system behavior and makes systems buttons not working all times.
removing isUserInterractionEnable in the isEnable override solve this problem.
I've got a keyboard toolbar that isn't being hidden properly. If the user hits the Done button, I call the following code:
- (void)accessoryDoneAction:(id)sender {
[self.selectedAmount endEditing:YES];
}
Then if the user moves to the next screen, comes back, locks the phone and unlocks it everything is fine. However, if the user does not hit the Done button, and moves on to the next view, comes back, locks the phone and unlocks the phone, they will see the keyboard toolbar at the bottom of the screen.
The only difference between the two scenarios, that I can see, is that if the user does not hit the done button, endEditing isn't called until viewWillDisappear: or viewDidDisappear: (I've tried both.) Neither one seems to have the same effect, as the toolbar is still present after moving on, coming back, locking and unlocking.
I've even tried placing it in viewDidAppear: after reading through this thread Keyboard does not disappear after viewDidDisappear on iOS 7, but that didn't work either.
Any suggestions for why calling endEditing: in the lifecycle methods isn't accomplishing the same thing as calling it when the Done button is hit?
I have an app where UIViewControllers are pushed onto a UINavigationController using pushViewController. Once in a while, seemingly randomly, the pushed view controller loads (I know this because viewDidLoad is called), but it doesn't actually appear (viewDidAppear is not called). The app enters a state where the new view controller isn't visible, but presumably is on the screen because I am unable to interact with the view controller behind it. In other words, the UI is completely non responsive, but the app continues to run (background and main thread events continue to fire, such as animations and network calls).
Anyone have any idea what could cause a situation like this? Or any ideas about how to go about debugging the cause?
I am troubleshooting a strange behaviour of a UITextField in my app.
During editing the above textField, if the app goes to the background and comes back to the foreground, the keyboard disappears. I have kept breakpoints at all places where the resignFirstResponder is getting called. But, I am unable to find the cause of the disappearing keyboard.
Is there any instance when the keyboard will be dismissed without specifying resignFirstResponder explicitly in code?
What is the expected standard behaviour in the above case?
I have a view with a UIDatePicker (inserted in storyboard) and in which in the viewDidLoad instantly a textfield gets first responder status so the keyboard is visible.
This view loads quite slow (about 2 seconds the first time, 1 second thereafter). I've checked my app in the time profiler and nothing special visible. Just some peaks (as expected) during the segue, however none of my methods or code is responsible for that. After I've removed the UIDatePicker and the immediately visible keyboard it was a lot faster. But I need them both..any advice how to that? Can I preload this datepicker and the keyboard somehow and just reuse them?