How to remove searchResultsTableView? - iphone

I have a UISearchDisplayController that displays some cells after a user has searched. After the user clicks on the cell, I am pushing a new view to my nav stack. How can I remove searchResultsTableView from the view so that when the user goes back, he doesn't see the searchResultsTableView?

See the documentation of UISearchDisplayController it sais:
setActive:animated:
Displays or hides the search interface, optionally with animation.
- (void)setActive:(BOOL)visible animated:(BOOL)animated
Parameters
visible
YES to display the search interface if it is not already displayed; NO to hide the search interface if it is currently displayed.
animated;
YES to use animation for a change in visible state, otherwise NO.
Discussion
When the user focus in the search field of a managed search bar, the search display controller automatically displays the search interface. You can use this method to force the search interface to appear.
Availability
Available in iPhone OS 3.0 and later.
Declared In
UISearchDisplayController.h

Related

Creating a Drop Down Menu with Xcode 4.3.2 Storyboards

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

ABPeoplePickerNavigationController with editable ABPersonViewController

I am using an ABPeoplePickerNavigationController to display contacts. When a user selects a contact that contact's info is displayed in what I'm assuming is a ABPersonViewController - this is the behavior that I want. At this point, I would like to be able to edit the contact data by providing an edit button in the righthand side of the ABPeoplePickerNavigationController's navigation bar. Can this be done?
I've tried several things including pushing my own ABPersonViewController onto the navigation controller but even with the 'allowsEditing' flag set and the navigation controller's 'rightBarButtonItem' set to an UIBarButtonSystemItemEdit it wouldn't show the edit button?
just set ABPersonViewController's property allowsEditing and editing YES. Then you can control the saving action.

IOS, tableview filtering select with a search control

I am building a tableview list with a search control to filter it. My requirement is to let user select one cell quickly by input some keywords.
The UI is simple, a navigationbar with an OK button to confirm the selection, a searchbar below the navigationbar, and the tableview in the bottom.
The problem is that, when user try to filter the tableview, the navigationbar would be disappear, the whole screen will go to search mode, the searchbar would in the top of the screen. In that case, when user selected a cell, he/she could not click the OK button I put in the navigation bar to confirm the selection, he/she have to hit the cancel button of the search bar to exist the search mode and then click the OK button I put there. That is not I want to.
How can I deal with this, to make this operation more easier for my user?
Can you try UISearchDisplayController ? It works like an autocomplete box.
http://developer.apple.com/library/ios/#DOCUMENTATION/UIKit/Reference/UISearchDisplayController_Class/Reference/Reference.html
A search display controller manages display of a search bar and a table view that displays the results of a search of data managed by another view controller.
Example:
http://developer.apple.com/library/ios/samplecode/TableSearch/Introduction/Intro.html#//apple_ref/doc/uid/DTS40007848
Hope this helps.

Remove UISearchBar on tableView click

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.

MoreViewController, edit, noneditable icon

I am using TabBar with more than 5 icons, co I get the MoreViewController as well and can edit icons in the TabBar. But I did not find the option how to forbid editing of one of the icons - similar to More. How can i fixate one icon?
In the docu there is description of beginCustomizingItems, which if containing the item, will make it non-editable - thats what I want. But I did not find how to use this method. All is done automatically.
In your UITabBarController, set your customizableViewControllers to an array of viewControllers that can be customized.
From the docs:
"This property controls which items in the tab bar can be rearranged by the user. When the user taps the More item on the tab bar view, a custom interface appears displaying any items that did not fit on the main tab bar. This interface also contains an Edit button that allows the user to rearrange the items. Only the items whose associated view controllers are in this array can be rearranged from this interface. If the array is empty or the value of this property is nil, the tab bar does not allow any items to be rearranged."