iOS7 Navigation Bar Glitch On App Open and Close - ios7

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.

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.

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.

Black bar between navigation bar and tableview since migration

Firstly, I'm French so; sorry for the english mistakes, I hope you'll understand my problem. I've only been working on iOS apps 3 months, maybe I havn't got all iOS development concepts.
I have an app correctly running on device and simulator using iOS 5 but when I try it on a iOS6 device or simulator I have a weird situation. A black bar appears at the top of the screen between the navigation bar and my tableview.
I did some research, others have the same problem but, what solved their problem didn't work for me.
See: Black bar between navigation bar and table view appears on iOS 6
I'm facing this problem since I upgraded my xcode version to 4.5 and the iOS6 SDK. See the following screenshots of the simulator, firstly running iOS6 then iOS5. The weird thing is that the black bar is here just after the application is launched. If I changed tab (obviously viewcontrollers are switched) then the black bar is no longer present.
I try to change the first viewController by switching the element of my tabBar but the same situation appears even if I put the tab called "Tendances" in first. The black bar is on this view but not on the others.
I have made these screenshots on the iphone 3 simulator but using iphone4 or 5 simulator or a real device didn't resolve my issue.
Screenshot 1: I launch the application on a iOS6 simulator. You may see that the black bar is betwen the navigation bar and the tableView header.
Screenshot 2: I'm still running the same app on the same simulation (iOS6), I decided to switch tab, using the tabBarController. The black bar disappear.
Screenshot 3: I go back to the first tab then there is no black bar...
Screenshot 4: I closed the simulator running iOS6 for another running iOS5. I launched the app then as you may seen there is no black bar.
I had the exact same problem: when first launching the app / this tableviewcontroller (mine is a fetchedresultscontroller, just to be more clear), the navigation bar would shrink in height and a black bar would appear in between the navigation bar and the viewcontroller's items. If I switched to a different view controller (not a tableview one) and came back, the bar would be gone and the nav bar back to its normal size. I have spent my last 3 hours looking for answers and just trying everything out there but nothing worked for me.
What did work in my case is a pretty weird solution: making the navigation bar invisible and then visible once again. So it seems like this actually loads it twice, first time being with the black bar and the second one, back to normal.
In my viewDidLoad I have this now:
[self.navigationController setNavigationBarHidden:YES];
[self.navigationController setNavigationBarHidden:NO];
Try this solution: How to set the top position = 0 after setStatusBarHidden:Yes?
I had once had the same issue, struggled through a lot of SO pages but this was the ultimate solution.

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

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.

XCode Redraw portrait layout with double high status bar

I'm having this issue with several screens in my app, but I'll explain what happens to my home screen. Hopefully the solution isn't as complicated as I'm thinking it will be. So my home screen has a logo at the top, a label(title) under that, 3 horizontal buttons under that, and finally, settings and info buttons in the bottom left and right hand corner respectively when if portrait orientation. In order to allow for landscape orientation, resizing masks were not able to achieve the look I wanted so I implemented the
-(void)willAnimateRotationToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration
method with an if and else statement, the "if" uses CGRectMakes to draw all of the elements where they should go in landscape layout, and the "else" redraws them back to their original places when changed back to portrait landscape. This all works very nicely. I remembered that we had to be able to handle the double high status bar, so I simulated it to see what it would do to my app. When I am on the home screen and toggle it on and off, the autoresizing of the items(which are set to adjust according to the top of the view) work nicely, by slightly squishing everything down a bit, and not hiding anything. I can toggle it off and on with no problems.
Now here's the problem:
When I have the double high status bar toggled on while on a different screen, then go back to my home screen, the resizing doesn't happen, and it redraws my screen full size according to the coordinates and sizes I have in the method I mentioned earlier, so the settings and info button are drawn halfway off the bottom of the screen. Same happens when switching from landscape back to portrait on the homescreen with the double high status bar already on.
Similarly, I have a map between a nav and tab bar on another page. When already on the page, and toggling it on and off, everything resizes nicely(the frame of the map changes height and the nav bar moves down). But again, I have a problem when switching to that screen from a different screen or from the landscape orientation, because instead of autoresizing appropriately, the map view and nav bar get pushed down behind the tab bar partially, obscuring the google trademark which is grounds for app rejection.
Sorry for the longwindedness, but I wanted to clearly describe what circumstances cause this problem. Any ideas would be greatly appreciated as I don't really have any idea how to approach this.
I've been trying to track down this problem myself. I think this happens because the autoresizing mask is only used when views are resized, and not when a new view is added to the scene.
For me, I wanted a settings view loaded from a nib and added on top of everything else. If the double-height bar was in effect when the view was added it would run off the bottom of the screen. To fix it you have to set the size and position of the view yourself when you load it. This is the code behind my working 'goto settings' button:
- (IBAction) settingsPressed:(id)_sender
{
NSArray* a = [[NSBundle mainBundle] loadNibNamed:#"SettingsView" owner:self options:nil];
SettingsView* settings = [a objectAtIndex:0];
settings.frame = self.view.bounds;
[[self view] addSubview:settings];
}
The important line being:
settings.frame = self.view.bounds;
Which, it would appear, classifies as a 'resize' and so the resizing-mask rules apply. I later added animations for the transition and it continues to work just fine.
Note: This method was in a View Controller.