We have a UISearchBar backed by a UISearchDisplayController in our app. Changing screens with the search bar hidden partway under the header causes that portion of the bar to be gone when the user returns, revealing the search bar's background. Here, I have it set to red which shows me that the search frame size and position are still correct.
Tapping anywhere inside the bar brings up the keyboard as expected. However, once the bar moves to the top of the screen, the part that was hidden stops responding to input. This blocks text selection and taps to the top of the Cancel button.
I have experimented with all of the answers in this question without success, so I think our issue is different, though likely related. Does anyone know what's going on, and how we can fix it? Thanks for your input.
If you are running on iOS 7.0 version then you need to set following property which is newly introduced in iOS 7.0 as follows
self.edgesForExtendedLayout = UIRectEdgeNone;
as by default edgesForExtendedLayout property is set to UIRectEdgeAll that means the view controllers use full-screen layout by default. And your's searchbar appeared to be rendered behind the navigation bar, starting from navigation bar offset.
Related
I am trying to make it possible to exchange the tab bar with the tool bar on iOS when the UITableView enters the editing mode.
However, when I set the
func updateBottomBar() {
tabBarController?.tabBar.isHidden = isInEditMode
actionToolBar.isHidden = !isInEditMode
}
, everything displays correct, however I can not interact with the toolbar. It seems like it is under the bottom layout guide, and the touches cant pass through. I tried bumping the toolbar.layer.zposition to 100, didnt work.
Note: if I programatically reposition the ToolBar to be a little bit higher, then exactly the portion of the ToolBar which is above the top of now hidden TabBar will be okay to interact with. Say i put the ToolBar 20points higher, then the 20 top points of the ToolBar allow me to press the buttons, and the bottom part doesn't allow.
I have:
extended edges under bottom bar disabled
Hides bottom bar on push disabled
user interaction enabled
right now. Changing those didn't give any success.
One possible issue could be your userInteraction of your custom tabbar being set to false.
You can do that directly in the your storyboard by opening the attribute inspector on your ActionToolBar
Also, to confirm you don't have any invisible view on top of your custom toolbar, you can use debug the view hierarchy when running on your simulator:
In my app I use a toolbar on the top because it lays out bar button items better for what I need, and I set the toolbars delegate to the view controller and tell it to be top attached. I also have a setting that will hide the status bar, so the issue that is happening is that when the status bar is set to hidden, and the app is closed and then re-opened, positionForBar is called but since there is no status bar, it doesn't do anything to the toolbar, so when I turn the status bar back on the app looks strange, and the toolbar is 20px down, and the status bar is showing but there is no background to the status bar, so it looks strange. positionForBar is being called still though but for some reason I need to close the app again before the toolbar will draw behind the status bar again. I have found out that if I remove the toolbar from the superview and re-add it again, it will draw behind the status bar, or i can remove positionForBar and have my own view be the background for the status bar, my old issue with this solution is that it won't be transparent (I could maybe put a 20px toolbar there though maybe?) and my problem with removing it and re-adding the view is then I will need to move a ton of my code around because remove it and re-adding it messes with constraints so I will need to fully reconstruct the entire view just for it to redraw behind the status bar. Is there a way to just refresh the view or something? I have tried setNeedsLayout and setNeedsDisplay and nothing really works for it to redraw besides removing and re-adding
Try manually setting the UIToolbar's frame:
topToolbar.frame = CGRectZero
Or updating the constraints, either will cause the UIToolbar to update its attachment.
In my App, I have a map view and I want to use a segmented control to change the map types (Standard, Hybrid, Satellite). The way I have the app set up, the status bar is hidden and it animates in, moving the navigation bar down a bit. To make sure it doesn't look awkward, I want to make it so the segmented control is attached to the navigation bar so it animates nicely as the status bar comes in. This is basically a picture of what I want to do:
So I noticed that the segmented control is inside a toolbar, so I contain mine in a toolbar as well. I've then tried adding the toolbar to the navigationBar as a subview. (self.navigationController.navigationBar). That works well accept that it can't be tapped because the navigation bar's frame doesn't enclose the extra space, so it can't receive touches. I tried making the frame of the bar bigger, and that worked, but the title and the buttons went away. Obviously there is some way to do this, and I would appreciate any help. Thanks.
I'm porting my app from iOS 6 to IOS 7 (there will eventually be a complete GUI redesign for iOS 7 but in the meanwhile just getting the existing GUI to display properly on iOS 7 is the goal.
I had the issue where the status bar was overlapping my GUI and so have shifted the Y origin of the view controller's view down by 20.
However my app contains a pulldown which when retracted is overlapping with the status bar. In the screenshot the red is a button which is present in the pulldown view. The grey bar is the top of the main view behind which a portion of pulldown is hiding when retracted.
I implemented the pull down as a fixed size child subview of the main view and when retracted its Y origin is a negative number thus it is effectively still displayed but off the top of the screen. When the user pulls it down I just animate the increase in the Y origin until eventually the origin is 0.
Is there some way I can make the pull down view appear beneath the status bar or some other quick solution?
Note of course I can't simply toggle the pulldown's alpha to display/hide it as it pullsdown obviously thus its appearance/disappearance is not a discreen action. I could maybe attempt to make the portion of it that is on top of the status bar invisible but as its something that is moving that seems like its going to be complicated. Is there any simple solution?
Thanks
Add another view, with a fixed position, under the status bar (with the same color of your grey bar), 20px tall and same width of the status bar, but with a z-index higher than the retracting view. This view will cover the retracting view (but not the status bar) acting as a "background" for the status bar itself. Obviously you have to adjust the Y position of the retracting view to make it tappable by the user (but under the status bar)
iOS 7 by default lets views take up the fullscreen, including the status bar. This is controlled using the UIRectEdgeAll property.
If you want the old style view, set UIRectEdgeNone for self.edgesForExtendedLayout
in viewDidLoad:
self.edgesForExtendedLayout = UIRectEdgeNone;
I'm having a very annoing problem on iOS7. I have a VC with different subviews, one is a tableview that is display fullscreen after pressing a button. This tableview has a search bar with a scope bar in its header that is linked to a search display controller.
On iOS 6 everything runs fine, when I press on the search bar the scope bar is displayed and the rows correctly slide at the bottom as you can see in the images (forget about the big X).
On iOS7 I have a problem.
Everything seems OK(and it's under the status but I know how to fix that).
But when I start a search the layout change leaving some blank space at the top, this doesn't happen on iOS6.
How can I solve that? where this problem comes from?
Andrea
It looks like your search results are pushed down by the status bar height. Try fixing your header position (so it's not under the status bar) and see if that works. If not, you'll need to share some code to show how your layouts are constructed.