I use some classical UInavigationBar and UISearchController at head of a UICollectionView.
My searchController is sticked to my navigationBar as I can scroll into my collectionView and use my searchController at any moment.
I'd like to know if there is a way to add space between my UInavigationBar and UISearchController as described in screenshot below :
You can adjust this in your storyboard if you have one, just select your searchbar and define constraints with the constraint icon (it looks like a square with two bars on each sides). Tell me if you still have the problem.
Related
This is probably a simple fix, but I haven't been able to figure out what's going on.
I have a UITableView that looks like this:
When I scroll up, however, the cells are visible behind the title, like so:
I've tried changing the navigation bar to opaque in appDelegate:
UINavigationBar.appearance().isOpaque = true
I have also tried editing the top insets on the UITableView without success. Any thoughts?
If anyone else has the same problem, I just had to set the UINavigationBar tint color like so, and make it non-translucent:
UINavigationBar.appearance().barTintColor = colorDict[currentClerkship]
UINavigationBar.appearance().isTranslucent = false
I have a UISearchBar linked with a UISearchDisplayController in the header of a UITableView in iOS7.
I set the UISearchBar with the style minimal. When the searchdisplaycontroller shows his table it has the behavior of the picture below. The table is scrolling above the searchbar. When I switch the style of the tableview to Prominent the table scrolls under the searchbar as expected.
Is this a bug or this behavior is expected?
The text isn't floating above the search bar, it's going below. Minimal style doesn't provide a background so this is expected. It will, however, provide a background during activation if there is a navigation bar present (Minimal style really wants to be over either no content or blurred content).
You are free to add your own custom background if you'd like.
Try with
self.edgesForExtendedLayout = UIRectEdgeNone;
in viewDidLoad method. It works for me.
I think this issue may for the Auto-Layout or Auto-Resizing. Just check in the nib file in insppector view.
Make the x=0 and y=0 for search bar and for tableview x=0 and y=44 , now you will get the tableview below the searchbar.
I have two UITableViews and both show a space of about 30 px between the tabBar and the searchBar of the tableView.
The XIB in Interface Builder, looks good though, no space has been defined there.
Any ideas?
you need to set frame of both.
I have a problem, there is a way to separate the uisearchbar from uitableview?I want to put the searchbar at the top of the view, a little tableview at the bottom of view and an image between the 2 items?
thank you
kikko
I would like to have a UISearchBar on the top of my UITableView which hides when you scroll down: The answer is easy, I just need to add it on my table view header like this:
UISearchBar *search = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 320, 45)];
self.tableView.tableHeaderView = search;
[search release];
But the problem is that when you scroll up the UISearchBar fit to the top of the UITableView, and not the top of the UINavigationBar. To be more clear I made a screen in Mail (not good) and Game Center (good).
I want the same as in Game Center. Do you have any idea how they are doing this ?
You will need to hide the search bar on your own when you scroll the tableview. So, don't put it as a UITableView header. You could hide it by setting its height to zero. That way if your tableview is set to autoresize it will expand.
I would experiment with having the UITableView and the UISearchBar as peers within another view. The GameCenter image does not have the search bar as the table view header, rather it has them as separate subviews.
You could also look at UISearchDisplayController but I think it doesn't quite have the behaviour that you want.
Edit: This question is basically your question and has some code in the answers.
A tableview header will move while scrolling downwards. It is tableview's property.
If you want to place a searchBar with navigation bar. Why dont you place the search bar just below the navigation bar. Use search bar and separate tableview.
The right side 's UISearchBar is on the another UIView, it is not a part of UITableView. So, you can add a child view to put the UISearchBar, and another child view is for the UITableView.
This will answer your question :
iPhone: Hide UITableView search bar by default
same concept, different controller.
Good luck.