I have this project, where a modal pops up, to filter search results - the UISearchController is visible in my navigation bar when the modal pops up. I can't remove it, as it will look weird, as the modal doesn't fill the whole screen. The problem is, that the UISearchController is still active when the modal pops up, and if I tap it, it all goes crazy - so I want to disable the input field, but I really can't find out how to :/
So does anyone know, how to disable the input field in the UISearchController?
Best regards :-)
self.searchDisplayController.searchBar.userInteractionEnabled = false
Related
I got a funny question: "Can someone explain this behaviour?"
Click here to view .gif (I'm not allowed to post pictures yet)
Explanation: When I click on the search bar a new ViewController is being presented (the one you see in the gif). There the keyboard is immediately popping up. When I now dismiss the keyboard by scrolling down it seems like the cells that were behind the keyboard re-render or were not loaded yet... I have no clue where to search for this, so I spared the hassle of posting unnecessary code.
Thanks! :-)
Nothing is wrong with the gif. UITableView cells are created and reused when necessary. That is when they become visible or invisible. Since you changed the view controller with the keyboard popped up, only visible cells are created. The ones behind the keyboard are not initialized yet.
I have encountered a problem that is my search bar doesn't hide when I tap back navigation button.
In fact, isMovingFromViewController doesn't respond when search bar is active.
I would like to know when back button is tapped so that I could make the search bar inactive and hide the keyboard.
Have you ever seen this error before?
If so, please let me know how to fix it.
Thank you
Some code would have been helpful, anyway to hide a view after a click add add a function to the button then call viewName.isHidden. but i cant suggest more until i see a code or at least a screen
We use the standard UISearchDisplayController in a project built on iOS 6.1 SDK. There appears to be a bug when running the application on an iOS7 device - The controller lying underneath the modal controller gets the user interaction instead of the UISearchDisplayController.
Steps to reproduce:
Click on the search bar to give the UISearchDisplayController focus (modal view is shown on top of the viewcontroller lying underneath and the search bar is moved to the top of the window)
Write something in the search field to get the table view with results to show up
Click on the clear search field icon (X) or backspace the text in the search field
Now the modal view is shown instead of the table view
At this point if the user clicks on the modal view, the click is caught by the viewcontroller lying underneath the modal view causing faulty behaviour. This problem still remains even if the table view is shown again after the user has done another search.
Has someone else noticed this bug, and has anyone a solution to this problem?
I have a very simple story board . There is no code involved in this yet. The problem I am having is that when I change the transition to "Flip Horizontal" the text fields get disabled for some reason (i.e. clicking on the text field does not bring up the keyboard). This is triggered when with the following sequence: click on text field keyboard pops up -> hit next -> click on text field keyboard pops up -> hit back click on text field -> keyboard no longer pops up
After that going between the screens and clicking on text fields does not work (i.e. the keyboard doesn't pop up). It works fine if I use default transition.
Any ideas on why this is happening?
I'm not sure this is your problem, but your storyboard setup is wrong. It looks like you're going back and forth with modal segues. Every time you do that you're creating a new instance of the view controller you're going to, so you're piling up more and more controllers, none of which ever gets deallocated. Unless you're using an unwind segue, you should never go backwards in a storyboard with segues. So, when going from the controller you show on the right back to ViewController, you should just use [self dismissViewControllerAnimated:completion:] in code, and get rid of the segue.
I have an ipad app with a single textfield. When the user clicks in the textfield, I want the keyboard to come up without moving or covering the toolbar at the bottom of the screen. The closest I've come to this is the following:
[textField setInputAccessoryView:toolBar];
There are two problems with this.
The keyboard pushes the toolbar up when it appears.
When the keyboard is dismissed, it takes the toolbar with it!
If I could fix 2, then I could probably live with 1, but I'd rather find a solution to both. Thanks!
EDIT: I give up on fixing 1 based on TomSwift's answer, but can someone please tell me if there is a way to push up the toolbar when they keyboard appears and then drop the toolbar back in place when the keyboard disappears???? THANKS!
I'm pretty sure you dont have this option. In iOS the keyboard position is controlled by the OS - you can get notifications of where it is but I dont think you can control where it goes. What you're asking for is to slide the keyboard in and keep going until it's "above" your toolbar at the bottom of the screen.
Have you seen any other apps that do this?
The toolbar disappears upon hiding because it has been added to another view, and therefore removed from its original view. You'll need to re-add it as you initially did.