As iOS7 and xcode 5 is out, I am assuming we can talk about them. Today I upgraded to XCode 5 and suddenly on my mapView.xib I see a white bar below. I did not touch the xib file, what exactly is going on here and how I can fix it.
Don't worry. You'll have lots of fun re-adjusting your layouts. Some of the components dimensions changed drastically and probably you'll need to re-adjust windows and UIViews too.
This is because of structure of iOS 7, To resolve this issue select your background UIImageView in xib and apply following Autoresizing mask
After that create new imageSet with name "iOS7bgImg" and add device support [iPhone & iPhone 4-inch] and add respective images in a boxes with following resolutions.
320 * 480
640 * 960
640 * 1136
create a IBOutlet of backgroundImage view
Now check programmatically
if(iOS 7)
{
[Setup new image in your background]
}
That's it solve.
Open the xib and set the frame of the view of this view controller to the screen frame. In iOS7 the status bar is translucent and your view also is behind it. Therefore your view has to be 20 px taller to fill the screen.
Related
This is a picture of a UIView in another UIView with View 2 nested in View 1. Note that I cannot change the size of view 1.
This is what happens when view 2 is dragged outside of view 1; it forcibly turns into an iPhone XR, again, with the width and height properties grayed out.
I would like for these views to just be normal UIViews that have the ability to have their width and height changed. Any ideas as to why this might be happening? Am I missing a setting or property that's causing this to happen?
You have the View as: option set to iPhone XR. To change that, click on View as... at the bottom and change it to a different device (preferrably to one without a notch, such as the iPhone 8).
Here's how to do that (click on the images to enlarge them):
To change the size of a top-level UIView, follow this guide.
In one of my app, i have not used navigation bar for header. I have used UIView which is of 64 height.
I just tried to design one screen app in xCode 9 to support iPhone x.
In storyboard, I have used UIView with 64 fixed height, and a label which is center to UIView
Everything is working fine in iPhone 8 and iPhone 8+, but in iPhone x, design is not looking good.
Fixed view looks small in iPhone x.
Please check below images
As i have start developing for iPhone x for other application, navigation bar gets bigger in iPhone x (around 145 px).
How can i manage design in iPhonex without navigation bar?
What you need are safe margins. Official Apple tutorial on iPhone X explains everything about them here in "Human Interface Guidelines
iOS" and here in "Designing for iPhone X".
1. Add subview to ViewController
Let’s get started by adding a subview into the view controller. This subview will be our custom navigation bar. Let’s setup auto layout accordingly.
Setting up auto layout constraints on custom navigation bar
NavBar.Height = 44
NavBar.Top = Safe Area.Top
NavBar.Leading = Safe Area.Leading
NavBar.Trailing = Safe Area.Trailing
the constraints are between the custom navigation bar and the safe area
2. Add ImageView as Background
Take an image view that display our background image. This imageview should be behind our custom view for navigation bar
Setting up auto layout constraints on image view
Image View.Top = Superview.Top
Image View.Leading = Superview.Leading
Image View.Trailing = Superview.Trailing
Image View.Bottom = NavBar.Bottom (For this drag from imageview to customview and choose last baseline constraint)
Leading and trailing constraints are all between the image view and it’s superview.
For the bottom constraint, we will set it between NavBar.Bottom and Image View.Bottom. The purpose of this is to make sure that the image view will cover up the entire custom navigation bar.
3. Final Step
A. Set clear color of custom view
B. Set image on imageview
C. Make sure the content mode of imageview is “Aspect Fill” and “Clip to Bounds” is checked.
4. Unit Test
Test this in all devices from iPhone 5 to iPhone X.
In all devices expect iPhone X our custom view with image is 64 pixel, and in iPhone X it is using the safe area also.
Behaving the same way as default navigation bar.
I have UIViewController on storyboard.
On the image you can see top gray is simple UIView while bellow is UITableView.
And I set uiview to be 150 height.
I use autolayout.
Problem is that when I run app on iPhone 6 uiview height is about 40% of the UIViewController.
From some reason it's height is larger than 150.
Can somebody explain me how can I setup view so I have UIView always the same size?
I think the problem is with your view height....you can not give static height.... see the images and check out where you missing out....
and the o/p is in 4.7 , 5.5 , and 4 inch is
for all the height of view is looking same....that is of 150 height
Have you included an iPhone 6 launch image? My guess is that the iPhone is resizing up based on the resolution of the 4" screen. Include either a static launch image, or a dynamic, xib-based one, and I think that should fix your problem.
I have a scroll view in a storyboard and the app is to run on iPhone4s and iPhone5s with iOS5 and iOS6.
I initially created the storyboard and was running on an iPhone5 and now I'm testing with an iPhone4.
Isn't there a way of just using a single storyboard for both the iPhone4 and iPhone5 and the when views etc. will automatically resize themselves depending upon the device, or do I have to use two separate storyboards?
I've tried numerous things, such as changing the simulated metrics size and many others but I can't find anyway of the view changing its size automatically - as I created the storyboard initially for an iPhone 5 the view now seems stuck at a 548 height when loaded. SUrely there must be a way of specifying in the storyboard that its height comes from the device? (Its height is the full screen less the status screen).
Further details
There is UIScrollView inside a UIView, the UIView will resize, the UIScrollView will not:
Yes, you can do it in the "Size Inspector", inside the Utilities menu. There you can set the autosizing and origin of any visible element.
This works in iOS 5 and 6 and it's not required to use the Autolayout, which is only for iOS 6.
Size inspector:
Second screenshot:
You have to use two storyboards for iphone4 and iphone5. Then you can check the device size to load the .xib according to it.
I have an iPhone application that runs perfectly on the iPhone 4s but when run on an iPhone 5 some parts of the screen doesn't autoresize. The thing that isn't resizing is the UIToolbar. My application always runs in Landscape mode, so the toolbar is at the bottom of the screen and these are the dimensions of the toolbar:
X: 0 Y: 256
Width: 480 Height: 44
I've tried adjusting the auto-resizing tool to almost every combination and nothing works. I can get the toolbar to spread across the screen, but the 3 buttons stay the same size. Each button is of width = 148. Is there an easier way to have the entire application just automatically resize correctly? For some reason my iPhone app worked great on the iPad when you used the "x2" resize view. Thoughts?
so the OP uses stock items and they don't resize then!
I would add flexible spacer items in between each button -- they resize
To solve my problem I just used IBOutlets that connected to each barbutton and if the screen size was for the iPhone 5, the width would adjust accordingly for each screen, if regular screen (iPhone 4s and below); then stay the same. Not a very efficient way but it worked for me.
Take a look at the images and select the autosizing red lines, if you select the bottom line it will keep on the bottom always, and if you select top and bottom it will stay at the same place. So verify your UIToolBar autosizing properties.
EDIT
EDIT2
Check out this answer How to detect iPhone 5 if you can't autosize, one quick solution that occurs mi if to change the frame in the code. Check if the device is a iPhone 5 or 4S to give a specific frame so you can adjut the width.