I just started working on a new project which has been done when Xcode 6 was released. The previous developer has used a View instead of the navigation Bar at the top of a few views. I want to fix the height of the View at the top for the new iPhone X as the navigation view looks very small and is cut by the notch. And as the project was created earlier with Xcode 6 I don't see Safe area, is there anyway I can update my previous XIB's with Safe area without requiring to recreate them all ?
The other option I have is creating a new XIB and optimize it for iPhone X layout and call it when the view is loaded.
Related
I'm writing a split view (master-detail) iPad app using Xcode 10.2.1, and using the storyboard to do my layout. I wanted the main column a bit thinner, so I went to the split view controller's panel in the storyboard and changed with width in its size inspector (in the right-side panel). This works, but it doesn't update the child view controllers to reflect the new column size. How do I made this change propagate to the rest of my panels in the storyboard?
Storyboard Screenshot:
https://imgur.com/a/xJxuhrX
Simulator Screenshot:
https://imgur.com/a/Dt9G7PK
Something strange happened to my project after I upgraded to Xcode 8 and converted the project to Swift 3.
Most interesting thing is that layout shows fine in the simulator but in the Preview everything is shifted to the right. Center of all devices appears to be almost at the right edge. For example I drag a label to the storyboard select Align Horizontally and add a constraint to the top... in preview it shows up for all devices shifted to the right instead of in the middle but in the simulator label is in the middle, exactly where it is supposed to be.
Also, if I create a new ViewController is would work just fine in preview and simulator... Anybody knows what can cause this issue?
In Interface Builder, select the view controller and then choose "Update Frames" from the "Resolve Auto-Layout Issues" popover menu that is in the lower right corner of the Interface Builder canvas. The issue is that in Xcode 8, the size of the previewed scenes has changed. If you tell it to "Update Frames", the various subviews should be adjusted to reflect the new "simulated size" for the scene's top level view (assuming all of your constraints are properly defined).
Leaving Xcode and re-starting worked for me to get the correct view per device in Storyboard again.
I recently updated my XCode 6.3 to 7 and strange things started to happen with my auto layout constraints in the storyboard.
My app uses UITabBarController with three tabs. The initial tab has a UICollectionView with top constraint set to 44px from the top layout guide (there is a toolbar in the embedding UINavigationController.
When I run the app on iOS 7.1 (iPhone 4), everything looks fine. The collection view doesn't go bellow the toolbar. However in iOS 8.4 (iPhone 6) the collection view goes bellow the toolbar UNLESS I switch tabs and go back to the first one, where the collection view is positioned where it should be.
What I did:
Unchecked all "Extend edges under...." for every view controller in the chain
Set all simulated metrics for Status/Top/Bottom bars to "None" in every view controller in the chain
I had the idea to check for #available(iOS 8.0, *) and extend the constraint constant +20 pixels. But when I switch back to this tab, the collection view goes 20 pixels lower than where it should be.
So, I guess something happens to the view controllers when I switch tabs. What is it? Or is there any solution. I'm on a deadline and this is the only problem I have with my app.
p.s. I can provide source code and XCode screen shots if needed. But still, I think it's something more theoretical, than practical.
1) click on your UITabBarController in storyboard->identity inspector
2) uncheck "Adjust Scroll View Insets"
repeat for individual view controllers inside UITabBarController
Sometimes this happen also to me. I suggest replacing the top layout constraint with an height constraint equal to the view of the ViewController, this resolved my problem.
I have transitioned my iPad application from iOS 6 to iOS 7 and I had to turn off auto layout or the whole application would crash when I selected to view the storyboard.
Now that I can view it, all the uielements don't appear in the each storyboard screen.
The screens are there but they are blank (white). The editor shows that they are there but I cannot view them at all.
Try changing the width and height/ x and y coordinate of the views. That fixed the same problem for me.
Im working on an app with a viewcontroller buried deep inside a drill down. Im working with autolayout and would like to view my changes without having to go thru the rest of the app processes.
is there a way to view what a scene will look like onscreen without having to run the entire app?
There is a menu option called simulate document. Unfortunately, newer versions of Xcode no longer have this available for iOS apps, OSX only.
If you only want to see the effect of changing between 3.5inch and 4inch phones, or orientation changes, you can change the simulated metrics on the storyboard. This will show you how your ui elements will lay themselves out based on your autolayout settings. Anything you are doing in your code in your view controller won't take effect since you're not actually running anything. This will only show you results based on things you have set in the storyboard.
To do this, select your view controller on the storyboard and open the Attributes Inspector (Cmd+Option+4).
All of the simulated metrics are likely set to Inferred. You can change the size and orientation here.
Using this you can at least find some errors. Say I have a button at the bottom of the view, but I set the constraint to "Top Space To Superview" instead of bottom. When I change the Size Simulated Metric to the 3.5 inch, this button will be off the bottom of the screen.