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?
Related
I have an app in production. On iPad, the layout is 2 table views on one layout. There is a search bar for the left hand table view. In iOS 9/10 this worked fine- the search bar, when expanded, simply appeared in the table view. In iOS 11, the same code will make the search bar expand out of the table view and attach to the nav bar area at the top of the screen.
If I change the presentation context of the search controller, then in iOS 11 it is completely broken and does not work.
self.definesPresentationContext = YES; //YES PRESENTS SEARCH BAR IN TABLE VIEW
I have created a demo project to simplify the example, this is directly Apple's table demo with the table view made as not full screen. The presentation context can be set to either the table view or not, and the search bar scope buttons can be easily added or not.
In the demo, the search controller, when presented inside of the table view, can be tapped in order to start a search, but is completely unresponsive to any taps - the cancel button, the X to clear text, trying to move the cursor. Keyboard text entry works and it will correctly filter the items. But then you're stuck and can't exit.
Here's a link to the demo project. Am I missing something or is this an Apple bug? Majority of code in APLMainTableViewController.m.
DOWNLOAD CODE EXAMPLE at this link
Full app image:
Correctly working search in iOS 10:
Demo project screenshot with bad search controller:
I'm trying to make an iPad version of the app I am developing. The app works really well on iPhones but I'm facing problems on iPads.
Basically, in the iPad version, I add a UISplitViewController containing a UITabBarController as main controller ( left side of the screen ) whose first view controller contains a UITableViewController.
There is a UISearchBar to allow the user to filter the table view.
The problem is, on the iPad version, when I use the search bar, an other table view - with filtered content - pops up with an "arrow" pointing at the search bar.
My question is : what is this other table view that appears and how can I disable it ?
EDIT
I found this on this website
In a few situations, the framework will automatically create and
display a popover for you. One such situation is what happens when a
search bar (a UISearchBar) tied to a search display controller
(UISearchDisplayController) appears in a toolbar (UIToolbar) on the
iPad.
That's exactly what I'm talking about. How can I disable this popover ?
EDIT 2
Just found this topic : UISearchDisplayController automatically creates a UIPopovercontroller to display content search result ?! How to dismiss it?
Problem is : the provided solution doesn't fit my needs. I'd like to be able to search directly through my table view, I just don't want this popover to appear at all.
EDIT 3
Solutions founds :
I am not using UISearchDisplayController anymore.
Either UISearchController or just a selector triggered whenever changes are made on my UISearchBar's text field.
This issue is quite simple to reproduce. And I think this may be a bug in watchKit.
If I display View with:
[self presentControllerWithName:#"OneButtonView" context:nil];
It works great.
If I use this view for one button, and open exact same view with that button, new modal view comes on top of original (as expected). If I click title - top most view gets closed and I see parent view. In this way I can create 10 pages and go back one by one to the very first one. Everything is great.
Issue exists only if you try presenting one/more modal views by using this method:
[self presentControllerWithNames:#[#"OneButtonView"] contexts:nil];
If I do that, new view is presented on top (as expected), I can close it by pressing the title (as expected) but title/titles for all pages that were created with presentControllerWithNames: disappear as soon as you come back from child modal view. This behaves identical for one or multiple views presented this way.
I tried setting title explicitly for one/all views presented this way but it didn't help.
Anyone encountered this or have any solution for this?
i am trying to implement some chatroom-like view controller (e.g. Messages-app on iPhone), and i would like to keep the keyboard enabled/open when this (chatroom-like) view controller gets dismissed and therefore gets popped from the stack, BUT dismiss it together with the view, i.e. sliding it out of the screen together with the chatroom-view-controller.
For the desired effect, just open the Messages-app on the iPhone, go into one chatroom/conversation, set the focus on the input-textfield so that the keyboard comes up, but then go back to the last view without dismissing the keyboard.
I always get this weird animation that the chatroom-view (-controller) is sliding out of the screen to the right (which is desired), but the keyboard gets dismissed to the bottom of the screen...
Does anyone know what I am doing wrong? I have already tried it with so many versions, from become/resign first responder in all the different view will/did appears...
My assumption is that it could have something to do with my custom pan gesture recognizer for popping the chatroom-view-controller from the stack of the navigation controller, but neither the docs nor the web contain such issues...
you don't need to keep your keyboard visible, instead you can make snapshot of chatroom controller right before it being dismissed.
Edit: I just created simple app with navigation controller which pushed controller contains text field. Then on app tried to pop that controller when keyboard is visible. And..all view was dismissed together with keyboard, so your wanted behaviour is given by default.
I am using Xcode 6 and the tutorial I am following is using a version of Xcode 4 and so this is another issue that has turned up (I followed tutorial exactly).
So I created two initial scenes - a log-in and a sign-up scene, both of which have a username textfield at the top and then a password textfield directly below it. I then added buttons below these text fields.
Now I have a problem where my top-most UIelement, the username textfield, seems to be overlapped by the navigation bar, in that I can't see the username field anymore.
I can see that the username text field exists when I look in outline, but have to double click on the navigation bar on top to see that field on the storyboard canvas.
I have a navigation controller set up. Embedded in it is a table view controller which links to the log in and sign up scenes - a show segue goes from the table view to the log in scene, and then another segue goes from the log in button to the sign up scene.
As well as the navigation bar blocking/overlapping my username text field, oddly there doesn't seem to be a Navigation item in outline for these two scenes- only the Button item and the text field items are there under the log in and sign up scene.
I thought that maybe I hadn't added the navigation controller properly and that it wasn't linked to these scenes, but when I run the program the navigation bar is there for all scenes, and anyway I can see it as a rectangular block at the top of my view (again for both scenes).
I need to make my Username text field visible, but also keep the navigation bar.
Is there any straightforward way to do this with interface builder or auto layout?
Would really appreciate any help.
I found a solution. I double clicked inside the navigation bar area where the textfield is hidden, and from there selected Drawing > View > Hidden.
The hidden checkbox was unchecked, so I checked it, and that made the username field visible inside navigation bar (strange!) and I then dragged it out of there and moved it to be underneath the navigation bar.
I would still like to know whether there might be a better way to have done this, I'm sure there is! But this is some kind of solution at least.
(I still cannot see navigation item in my scene outline)