Status Bar moves down UIImageView in iphone 4 iOS 7 - swift

I'm developing an app for iOS 7 using Swift. My app has a login view in wich I use an UIImageView to set a background image. Everything works fine but when I test my app on an iphone 4 the status bar moves down the UIIMageView a little, as you can see in this image:
The UIImageView is positioned at y = 0(Align top to superview) and with and align center x equals to 0. The view mode is scale to fill.
The UIViewController that handles this view just control if the phone has internet connection and don't do anything with the UIImageView.
I tried to set the status bar hidden in the info settings of my project, also in the info.plist file and in the appdelegate when the app is launching by using the method setStatusBarHidden, but nothing works.
How I should deal with with the misplacement of the image, I don't care if I have to hide or not the status bar?

Related

Difference in layout of simulator and XIB

I have an issue in position of UI on window through XIB
I have added some images in XIB below navigation bar but when i run the app then in simulator its showing first two image under navigation bar i.e upper images and overlapped by navigation controller.
Use autolayout is disabled for view.
Position of first two images view is show X=0 y = 0 and x = 160 and y =0.
I think this is case in IOS 7 only
Please see the screenshots at
http://tinypic.com/view.php?pic=so9z5t&s=5
One more problem in below mentioned screenshot
http://tinypic.com/view.php?pic=a11tug&s=5
Image view is staring from y=0 but when running then on simulator its showing too much below. and black area is view
image view is sliding lower down.. very very mush odd behaviour of Xcode 5
In iOS 7 by defaults all Controller translucent property value is YES, so you set translucent property NO for this issue.
self.navController.navigationBar.translucent = NO;

AutoLayout problems in iPhone5

I have a Xcode 4.5.2 Project
I have a story board with with four UIViews.
Autolayout is Set to ON in the StoryBoard
Deployment is iOS 6
I want the letterbox to appear on top and bottom when running on iPhone 5 and not have my views resized when running on a iPhone5
When I run my app in iPhone5 - I do not see the letterBox - the UIViews are automatically stretched (incorrectly)
When I run the App on iPhone 4 - Everything is as expected.
Why does the letterbox not show as I would expect?
If for some reason you want your app to behave on iPhone 5 the way older apps do -- automatically letterboxed by the OS to 3.5-inch screen dimensions, just don't include a Default-568h#2x.png in your app. However, Apple expects new apps submitted to the App Store to support 4-inch screens, so you might not get very far with this strategy if you're expecting to distribute your app that way.
If you want to "support" iPhone 5 (and iPod touch 5th generation) screens, but keep most of your UI at older screen sizes... well, your users may not like it (and the App Store reviewers might not either), but it's possible using Auto Layout. The catch is that the root view in your window's (or rather, your view controller's) view hierarchy is always automatically resized to fit the screen -- but there's no saying that has to be the main container for your actual UI content.
In IB, with the editor in 3.5 inch screen mode, drop a new UIView into your view controller's root view. It should automatically size to fill the screen (460 points high).
Add a Pin > Height constraint so the view stays 460 points high no matter how its superview gets resized.
Add an Align > Vertical Center in Container constraint so the view stays centered when the height of its superview changes.
Put all of your UI inside this view.
Now you'll get white bars (change the color of the root view if you like) above and below your UI when on iPhone 5.
Note this only works as long as your UI doesn't rotate to landscape. I don't think you can do this kind of artificial letterboxing for both orientations using only one set of constraints, so if you want to support rotation you'll need to respond to an orientation change by switching out constraints programmatically -- pin height and center vertically in portrait, pin width and center horizontally in landscape.

Buttons to the right of Landscape not responding in iPhone iOS5 simulator

I have an iPhone app which runs only in landscape orientation. There is is a button on the right side of the screen and one to the far left.
The bottom on the left side work and responds to touches. However, the button on the right side does not respond to touches.
If I display another view and return back to the main view all buttons work.
If I move the button to just before the 3/4 mark on the screen the button works.
If I run the app using the iOS 4.3.2 simulator the buttons work as well.
I am stumped on why buttons just past the 3/4 mark on the landscape screen are not responding.
The app was originally written using xCode 4.1 and iOS 4.3.2. I have opened the project in the new xCode and iOS SDK and this behaviour started.
Specified the frame size for the view in the AppDelegate code before adding it to the MainWindow.
Add the code before adding the view.
viewMgrClass.view.frame = CGRectMake(0.0, 0.0, 480.0, 320.0);
It goes before this line:
[window addSubview:viewMgrClass.view];
I could not figure out how to the MainWindow to be portrait.

Launch image - iPhone application

I have two files for the Launch image for my iPhone app.
Launch.jpg: 320x480
Launch#2x.jpg: 640x960
In my .plist, I have the following key-pairs (amongst others):
Launch image (iPhone) = Launch.jpg
Status bar is initially hidden = NO
However, when my app first launches, the top 20 pixels or so of the Launch image are blocked because of the status bar. How can I tell my Launch image to start below the status bar upon launch?
If you need the status bar to be present on the launch screen, your best option is to modify the launch images themselves to make room for the status bar. As the top 20 pixels is being cut off by the bar, simply modifying your Launch.jpg to have the top 20 pixels blanked-out will do the trick.
If you don't need the status bar on the launch screen but want it on the application, set it to hidden in your Info.plist and have your application do:
[[UIApplication sharedApplication] setStatusBarHidden:NO animated:NO];
once it finishes launching.
You need to set the Status bar is initially hidden to YES to hide the status bar while the splash image is shown.

iPhone UIImageView not showing in set size

I have a simple app, straight out of the SDK TabBar template, where I implemented UIImageView outlet set in the AppDelegate UIWindow. I want to display there a static image each time user taps a tabbar item. It works fine (the image is displayed and hidden when it should) with one exception:
I have created the UIImageView in IB and set the size 320x430, so the image does not hide the tabbar. The problem is, UIImageView always shows the size of the window, covering entire screen. Any idea why?
Make sure that you set clipsToBounds to YES.