we're showing search results both in a table view and on a map in our app. The user can show a map over the search display controller by tapping on a button. The map is shown by simply moving the map subview to front so that it covers the table view.
When we attempt to write UIAutomation tests for whether the map view is visible, isVisible on the map view always evaluates to false, even though the map view is clearly visible and we can interact with it. If we never tap the search bar and type into it (table not shown) then the map view isVisible evaluates to true. It feels like UIAutomation just checks whether there is a UISearchDisplayController and assumes all other views are hidden by its table view.
Has anyone else experienced this? I've filed a radar as i believe it's a bug http://openradar.appspot.com/radar?id=5890626432270336
Test project: http://s.swic.name/X1Su
Related
I'm a noob at Obj-C, and especially at the concept of storyboarding. It seems like storyboarding could be so awesome yet it is not intuitive at all.
I'm trying to make it so when this button is pressed, the user will see a drop down menu letting them pick from either All, Read, or Unread:
Do I drag a new view controller out and put in a drop down selector in that and then segue to that view from the button?
P.S. What system icon should I use to represent the read/unread filter? The one I have just isn't right. =]
P.P.S. This project is open source: https://github.com/kirkouimet/enzyme
Well, I guess the most native control for this would be a scope bar, but this must be attached to a search bar, which may not be what you're looking for. The scope bar basically would only appear when the search bar is the first responder (i.e., when it has the keyboard's focus).
If you're developing for iPad, you could use a popover controller. Simply create a view controller to manage the buttons for your filter and use a UIStoryboardPopoverSegue to transition to them.
These two questions involving popover segues may help:
- iOS - Create an Popover View using StoryBoard
- UIStoryboardPopoverSegue opening multiple windows on button touch
You may also want to consider using a segmented control inside a toolbar—using the UISegmentedControlStyleBar style—and situating that above the search bar you already have. Then you would just create a IBAction method (probably in your root master view controller) that responds to the UIControlEventValueChanged control event. You can use that to determine which segment was selected to do your filtering.
Something like this...
From top to bottom:
Navigation bar
Toolbar
Flexible space
Segmented control
Flexible space
Search bar
Table view
I'm looking to create a UI similar to that of the Maps application just to try out some odds and ends and brush up on my knowledge of interface builder.
What i'm struggling to discern at the moment is how the Maps application handles the interactions between the toolbar and the navigation controller and which UI elements are needed to mimic the interface. I'm guessing that the Maps app only has one view controller which kind of negates the need for a navigation controller so i'm not sure if i'm using the right application template currently but i'll come back to that one later.
To give you an idea of what I'm looking to copy, if you search for directions between two locations and then hit route, the navigation controller changes from:
[Clear] Directions [Cancel]
to:
[Edit] {car | train | walk} [Start]
That's all fine so far, nothing out of the ordinary from what i'm used to doing. What is confusing me however is the semi transparent view underneath the navigation controller that displays the total distance and time (or other information depending on the search method). What is the UI element? Is it simply a toolbar tacked on to the main view? How would I go about adding this to my app, is it part of the view, or part of the navigation controller?
Also, in a similar vein... Clicking the "Search" segment in the toolbar displays the search field at the top of the app. Is this in the navigation controller, or is the navigation controller hidden whilst the search field is displayed? Again, clicking "Directions" displays the search field but this time with an additional search field and a button to switch the order of the fields. How is this achieved?
I'm not so good with the terminology so excuse me if i've mixed up some terms. I'm just trying to get to grips with the UI elements as i've spent most of my time learning OpenGL so it's all a bit new to me still. If anyone can point out the right UI elements used in the Maps application, that would be greatly appreciated!
Many thanks for reading.
Edit: I've uploaded an image to illustrate the UI elements i'm querying in this question.
I have no inside information, so I'm speculating on how I'd do it.
I'd use a UIToolBar for both the top and bottom bars, not a navigation bar. You can put a tool bar anywhere as they're just a subclass of UIView.
The semi transparent view underneath the navigation controller is likely just a custom view on top of the map view. Again, just a subclass of UIView.
The items in both toolbars would call methods in the view controller that could change the contents of either tool bar or hide or show other views.
For example, the Search button might call a showSearchToolbar: method, while the Directions calls a showDirectionsToolBar: method. Both methods would just change the contents of the top tool bar and hide or show the view beneath the top tool bar.
Check out the UICatalog example code from Apple to see how to dynamically change the contents of the tool bar.
I have a UISearchBar which is subviewed by another view when a button is pressed. When it loads, it looks like the following (minus the red scribbles):
I would like to have the UISearchBar view be removed from the parent view controller when the tableView (the area with red scribbles) is clicked and is empty (no search has been made yet). I'm having a difficult time figuring out the best way to do this.
I have tried to put a transparent button in that section and add it as a subview to the search bar. However the button is underneath the tabl view area, so when the table view is clicked, the search bar loses focus and the uibutton is only then accessible.
Does anyone know how I can remove the search bar from the parent view controller when the empty table view below it is clicked?
Thanks.
To bring the transparent button up and make it catch all touched first, use [button.parentView bringSubViewToFront:button].
Another approach could be to catch the search bar losing focus (since you say you see that happening), by putting
– (void)searchBarTextDidEndEditing:(UISearchBar*)searchBar
in the search bar delegate, and handling it from there.
In OS3.0 a lot of plain table views have an initially hidden search bar that can be accessed by scrolling down to reveal it (e.g. mail, ipod).
Is it possible to do the same thing for a grouped table view?
Background:
I'm using a grouped table view as a static navigation menu (similar to the Things app). The content never changes, it's just a way to choose which view to push next. Above the table view, I have a search bar. I'd like that search bar to be hidden initially, as it doesn't look good and may also be confusing for new users - also because that seems to be the standard now.
Note, the search bar has nothing to do with the datasource of the table view it's in - it's not searching the contents of that table view. It's a search on a remote server. The results are displayed in a new view which is pushed on the stack. The search bar is intended to be just a quick way to get at that functionality.
UITableView inherits from UIScrollView, so set the bounds of the UITableView to move the search bar out of view when the UITableView is about to start displaying.
I have a ordinary UITableViewController inside a UINavigationController. The former includes a searchbar which is connected to a search display controller. I use the standard behaviour, i.e. when the user enters any character the search results table view overlays the normal table view.
Now, both table views act inside a navigation controller. If I select one item from the search results table view, a new uitableviewcontroller (with specific information about the item selected) gets pushed onto the nav stack. When I hit the back button on that controller, I observe a strange behavior: The section headers of the normal table view overdraw the section headers of my search results table view. They are displayed as if my normal table view is being displayed (I can see that from the number of rows between the headers, though the rows remain empty). The search result table rows are still being displayed.
This behavior comes from the fact that I reload the table view on viewWillAppear. I do this to react on changes in the database made by the user at some other point in the application or automatic background data updates. I already tried to poll if the recently displayed table view is being shown via
(self.tableView == self.searchDisplayController.searchResultsTableView)
but that statement is always false after I return to my normal table view controller.
The question: how can I poll the correct state of my table view to avoid the displaying errors?
The UISearchDisplayController class implements an active property. Guess what it's used for :-)
e.g. just check for (self.searchDisplayController.active) or ([self.searchDisplayController isActive]).