Autoresizing different between ios 4.x and 5.0 - objective-c

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.

Related

segmented control in navigation bar broke with latest Xcode 9.2

I have an app with a segmented control in the navigation bar as a navigation item that when I build with Xcode 9.2 is broken. Doesn't respond to touches in two of the segments and it is not positioned correctly anymore (should appear centered in the nav bar) Nothing has changed in the project. I.e. I build the same version that is approved in the app store.
Any ideas what may have changed with Xcode that could be causing this? I'm targeting 9.1 so it isn't anything to do with iOS 11. When I go into story board the segmented control isn't appearing inside the View anymore it is off by itself in a blank part of the story board (see second image below).
Update: If I remove all constraints for the segmented control then it appears in the correct location but I still can't see or select it in storyboard.

UI Tab Bar added to Storyboard not showing up when I build the App

I have an iOS App. I currently have an existing View Controller. I manually added a UI Tab Bar to it using the storyboard.
I added the UITabBarDelegate and implemented the corresponding functions required tabBar:tabBar didSelectItem:item.
I've also connected the delegate of the Tab Bar to the view controller itself.
However, when I build, the Tab Bar completely does not show up at all.
I know you can just use a Tab Bar Controller, but I need to add the Tab Bar to it, and use the Tab Bar to modify content of the view itself. (specifically it acts as a filter for a table view) So, it doesnt make sense to create 4 exact same Views to hook up to a UI Tab View Controller
What am I doing wrong?
I found out what's wrong.
It turns out, I had completely successfully implemented the UITabBar. What happened was that I was testing on an IPhone 4. As such, it bled out of the screen and could not be seen. Adding constraints fixed it.

Making a nav controller work the same in iOS 6 and iOS 7

How can a navigation bar be supported in both iOS 6 and iOS 7 with a UIContainerView via a storyboard?
I am updating an iOS 6 app to iOS 7, but want to continue to support iOS 6. I have a main top level view that is embedded within a UINavigationController. The view within the navigation controller has a container view in it. I am using a storyboard to lay out the view.
On iOS 7 the navigation controller uses the entire screen, and I've set it up to put the container view content below the navigation bar. In iOS 6 the content of the view does not go under the navigation bar, so I have a blank gap below the nav bar.
Normally I would just reset the origin of the offending view on iOS6 (in ViewDidLoad or somesuch) and go on my way. However since my content is in a UIContainerView, I can't seem to change the frame after it loads. (I have tried this in prepareForSegue: when loading the UIContainerView. I'm open to having done this wrong? heh)
The closest I have found is using the following code under iOS 7 to make the nav bar opaque and keep the content out from under it, then using the entire space for my UIContainerView.
// tell the view to not extend below this nav bar
if ([self respondsToSelector:#selector(edgesForExtendedLayout)])
self.edgesForExtendedLayout = UIRectEdgeNone;
This solution works but has the side effect of showing the status bar as black (since it's more or less "blank" under the status bar). Alternatively, if I put the top edge of the container view below the status bar, on iOS 6 I have a big gap below the navigation bar.
I can eliminate the use of a navigation controller, but that seems a bit heavy handed in this situation and I'd like to use that as a last resort.
I've found the solution to this.
You need to set the barTintColor in iOS 7, which also seems to color the main status bar, as well as setting the nav bar to not be transparent like this:
mainController.navigationBar.barTintColor = [SRPRTabletHelpers customUserColor];
mainController.navigationBar.translucent = NO;
The non-transparency was the key, while setting the color sets not only the regular nav bar, but the color beneath the status bar as well.
I also needed to change my containerView top edge to be the full height of my view contained within the navigation controller, now that it is not transparent, and it works the same on both iOS6 and iOS 7.
While you mention to have already solved this, your method seems to require a lot of manual code and if checks. The iOS 7 UI Transition guide, in the Supporting iOS 6 chapter mentions another way: first design your interface for iOS7 as you have done, with your view extending below the navigation bar.
Then, in the interface builder open the size inspector for UI elements and modify the iOS 6/7 deltas. These values are applied when the storyboard is not run on iOS 7. For example, in your case you can select all your visual elements, then set the Y delta to -44, which is the standard navigation height. That will make the UI go up on iOS6, compensating the fact that the view doesn't go under the navigation bar.

ios7 - iPhone 5 giving white space at the top

Client has come back to me on projects saying they see white space on the top (they can't see the default things like time, wifi signal, etc) at the top.
This is happening when they installed iOS7 on their iPad.
Any idea why this is happening?
Note:
I have navigation bar as image. I hide the navigation bar and put navigation bar as an image.
Downvoters
I know this is not a perfect question for SO, but I thought to ask to take inputs. Tomorrow I am going to study on it.
try to insert following code into your viewDidLoad:
if( [self respondsToSelector:#selector(edgesForExtendedLayout)] ) {
self.edgesForExtendedLayout = UIRectEdgeNone;
}
Otherwise you could try it, by removing the UIStatusBar. Select your Project, go to the section General and select Hide during application launch inside the subsection Deployment Info. Next you have to add the attribute inside the Info section called View controller-based status bar appearance and set it to NO.
It's due to the status bar.
In your XIB or Storyboard chose to view your xib as iOS 6 :
On your view, add a Content View (you will add your outlets elements inside this content view) and add a Y delta of 20 (for the status bar) :
Now, if you compile your app on iOS 7 or iOS 6, your view will go up or down and you won't have the space anymore.

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.