Remove UISearchBar on tableView click - iphone

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.

Related

Custom popup view in Swift (Interface Builder)

Is there any way I can show a custom popup in the middle of the screen (over the current content) with buttons and a textfield and anything else I may need, entirely in interface builder?
If this isn't possible, then I don't mind doing it programatically.
I am guessing you create a custom view with the content but I am not sure how I show that view when a button is clicked and bring it up over the current view controller.
Thanks!
I would create a View and a Viewcontroller for it- set the alpha of the view to zero so its invisible - then but a nice picture as background for the custom popuop on it ( as background for the popup) on this i would put the buttons and the text label. Voilà - costum pop-up is ready to present with a segue (choose type over the current view controller).

Add UITextField to Navigation Controller's Toolbar as a Bar Button Item through stroryboard

I can do this programmatically but I don't prefer it that way. There's got to be some work-around for this. This is what my initial screen looks like:
To the toolbar, I dragged on a Bar Button Item and it fell into its proper place. Then i need a Text Field beside that. I dragged that from the library and dropped it beside the Bar Button item, and this is what I get:
What am I missing here?

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.

Need Suggestion for Add Button in Edit Mode of Table View

I have a tab bar app with a nav bar and table view. In the nav bar, the left is the back button to the parent view, the middle has the view's title, and the right button is the edit button.
I need to somehow have a button to add cells to the view. There is obviously no room in the Nav bar so I was thinking that when the edit button is pressed, the first cell in the table should be a cell that is also an add button. When the done button (which is the edit button just its text has been toggled), the add button cell would disappear. What do you guys think is this a good way to do this or do you have any suggestions?
Also, how would I start to implement this feature? Thanks.
My be this post will help you.
Edit:
Take a look to this tutorial

How can I dismiss the view appeared by touching Add item in UINavigationController?

I have added add(+ symbol button) button to my navigation controller.
When I click it a view appears from bottom. I added a navigation bar and two buttons to it.
One save and one cancel button. And the view have one textEdit box. After editing I can save or cancel. If I touch cancel I need the view to disappear like it should go down again.
I think all iPhone , iPodTouch users use it. Like when they touch Add item then a view appears from bottom and when they cancel it goes down again. How can I make in this way in my application.
Maybe you're talking about a UIActionSheet?!?
http://developer.apple.com/IPhone/library/documentation/UIKit/Reference/UIActionSheet_Class/Reference/Reference.html