UITableView Misalignment with Navigation Bar (cells get stuck underneath on rotate) - objective-c

I'm using the new Storyboarding feature in Xcode 4.2, and I've run into a problem where my UITableView seems to forget that there is a Navigation Bar upon device rotation. When the device is rotated, the cells appear to be trapped under the Navigation Bar. This bug is driving me absolutely insane, where I might just trash the project and start over.
Since I have recently noticed this, I am not sure if it is something that I had done / misconfigured or a bug. Nevertheless, to the issue:
Images of the Issue:
The image below shows what my application looks like once loaded. Everything is aligned correctly
Once the device is rotated, the UITableView ignores the Navigation Bar and assumes its space.
The problem persists even when the device is reoriented to portrait mode.
My struts and springs in Xcode are no different from a default UINavigationController dragged out from the object library. I've even ditched my UINavigationController and reconfigured a new one.
For the record, I do NOT have my main navigation controller subclassed.
Lastly, there is a similar post on Stack Overflow, but as you can see, my Navigation Bar does resize itself correctly upon rotation.

Add this in the didRotateFromInterfaceOrientation method.
[self.navigationController.view layoutSubviews];

Looks like you have wantsFullScreenLayout = YES in the UIViewController.

Related

iOS 13 UIImagePickerController Image/Video grid goes behind navigation bar

I am having an issue with UIImagePickerController. I'm presenting as Fullscreen. The issue is the images grid goes behind the navigation bar. I have even tried a new appearance proxy thing but no luck. Here is a link to the video of the issue.
UIImagePickerController issue
If anyone knows anything let me know, please.
I ran into the same issue recently(with iOS13).
The issue to me was resolved by setting UIScrollViewContentInsetAdjustmentAutomatic to [UIScrollView appearance] before present the image picker. Fyi.
if (#available(iOS 11.0, *)) {
[[UIScrollView appearance] setContentInsetAdjustmentBehavior:UIScrollViewContentInsetAdjustmentAutomatic];
}
As there is code which set UIScrollViewContentInsetAdjustmentNever in my project.
Remember resetting the value to be UIScrollViewContentInsetAdjustmentNever after the image picker finished its work.
As of iOS 7.0, all views automatically go behind navigation bars, toolbars and tab bars to provide what Apple calls "context" – having some idea of what's underneath the UI (albeit blurred out with a frosted glass effect) gives users an idea of what else is just off screen.
If this is getting in your way (and honestly it does get in the way surprisingly often) you can easily disable it for a given view controller by modifying its edgesForExtendedLayout property.
For example, if you don't want a view controller to go behind any bars, use this:
edgesForExtendedLayout = []
for your case you can use it like this:
yourvc.edgesForExtendedLayout = []
For your reference i am also attaching a link which also answers your question.

iOS7 Navigation Bar Glitch On App Open and Close

I've noticed some interesting behavior with an app in iOS7. The navbar normally has the following color:
On all real devices, when the app is backgrounded or opened up, the navbar is temporarily covered with a black almost gradient mask that looks like this:
In the simulator, when the app is open and is backgrounded, I get the same black mask over it but the black is slightly shorter from top to bottom, but when it is opened up again I get the following weird white streak:
This is all temporary, and once the app finishes launching it goes away. Does anyone know what would cause this to happen?
I finally tracked down the issue to the following code in a table view controller I had:
if( IS_OS_7_OR_LATER ){
self.edgesForExtendedLayout = UIRectEdgeNone;
self.extendedLayoutIncludesOpaqueBars = YES;
}
The weird thing is, I've used this a million times to make the tableView properly sit under the navigation bar rather than just under it, so normally without this code it doesn't work right on iOS7 - but for some reason it does now. I'll have to look more into that... For some reason removing it from all my tableviews fixes the problem, but removing it from my regular view controllers fixes the navbar color problem, but makes the view's sit under the nav bar again.
I solved this issue by making sure I checked "Under Top Bars" in storyboard on the View Controller's attributes.

How do I fix empty 44px space in iOS7 view with ViewDeckController?

I am in the process of transitioning an app to iOS7. All of the views throughout the app have a 44px empty space at the bottom that appears to be for a bottom toolbar or something, but I am not trying to display a bottom toolbar. This space also exists on views that do have a bottom toolbar and the toolbar just shows directly above it.
The red space shown is actually a view behind the black view. No matter what size I set the frame of the black view to, the red space is always shown. I am also hiding the status bar in plist, so don't know if this is an artifact from that or if it has something to do with navigation bar as they are both normally 44px in height.
I have looked at the transitioning guide and haven't found anything that's worked. Any ideas to what could be causing this and how to fix?
UPDATE:
I have tried setting edgesForExtendedLayout = UIRectEdgeAll and extendedLayoutIncludesOpaqueBars = YES (also tried NO) with no effect. When I look at the subviews of the navigation controller it shows a UIToolBar as hidden, but shows it contains a frame in the exact area the view refuses to resize to even with autolayout constraints.
UPDATE 2:
This is actually a problem with ViewDeckController (https://github.com/Inferis/ViewDeck) and the way it sets it's center view bounds.
I believe it has to do with the UINavigationBar. Try toggling the following options in Storyboard and see if it solves the problem. Namely, the 'Extend Edges' options:
These options can also be set in code with the edgesForExtendedLayout and extendedLayoutIncludesOpaqueBars properties on UIViewController.
If you are transitioning to iOS 7, you should be using an Auto Layout constraint to anchor to the Bottom Layout guide. Control drag from your view to the Bottom Layout guide and choose Vertical Space from the popup menu.
Using frames in iOS 7 is harder and is the way of the past.
Auto Layout is hard to grasp at first, but it is very powerful once you get the feel.
This is actually a problem with third party library ViewDeckController (https://github.com/Inferis/ViewDeck) and the way it sets centerViewBounds for IIViewDeckControllerIntegrated. I was able to figure it out after changing to IIViewDeckControllerContained and seeing the view sized correctly.
In IIViewDeckController.m, just return self.referenceBounds for iOS7 like it does for IIViewDeckControllerContained.

ios 7 navigation bar too small

I am trying to update my iPhone app to iOS7.
I am having major issues with the navigation bar. I would like it to have the new navigation bar.
As you can see from my image it has squashed the title to the top near the status bar.
I dont want to remove the status bar.
Surely it cant be that difficult to change.
I also noticed on some apps its changed automatically and on other apps it hasn't?
Did you try to add:
self.edgesForExtendedLayout = UIRectEdgeNone;
in the viewDidLoad method?
You should try and do it the correct way by adding your view controller to a UINavigationController and use its UINavigationBar. This will handle most layout issues for you and will also be backwards compatible. If you post the code where you bring your ViewController on screen, we will gladly help to wrap it in a navigation controller.

Autoresizing different between ios 4.x and 5.0

Been trying to figure out why this happens for a few days.
My app is supposed to have a shared view between all screens that handles navigation. So I made a nib for the navigation with a few buttons on it and added that view to the window (which I'm told is a bad choice)
This global view stores 4 navigation controllers so that users can swap between them without losing their place (much like how a tab bar works). But it looks as if adding the view to the window has affected the way my app resizes for the in-call status bar. In 5.0 the entire app works perfectly, but in 4.0 it's completely wrong.
On 4.0 if I enable the in-call bar on a screen it will not move at all.
If I push a view controller with the in-call bar the navigation bar appears at the top, but the view appears 20 pixels lower than it should
And if I have the in-call bar enabled, push a screen, then go back, the navigation bar moves down 20 pixels (as it should), but the view stays where it is and is clipped by the navigation bar.
What is happening on iOS 5 that isn't happening on iOS 4.x that makes these changes? the app is all buggy on 4.3.
Create a "dummy" view controller (UINavigationController works well). Then add your view to that. Without using a view controller hierarchy events will not be propagated correctly.
I suspect this works on iOS 5 because of the new "container" view controller system. They have moved the system to be more lenient in these areas. I can't give a more specific answer than that without seeing your entire app navigation design.
EDIT:
Also try using the wantsFullScreenLayout property. It may help.