After updating to Xcode 11 and iPadOS this is how my view looks:
https://imgur.com/a/BqyXyhN
Before the view was filling the whole screen.
When I switch to iPhone layout the issue disappears, but stays on all iPads.
I had the same problem. I verified this began with iOS13. The fix in my case was to change the presentation style of the View Controller from "Automatic" to "Full Screen".
I want to understand better what changed here from 12 to 13, and if this is a proper fix. I'll update with anything else I find.
For context, my View Controller was being presented with a "Show" segue, which is an adaptive segue. So perhaps the adaptivity defaults have changed in iOS13.
You might want to define some constraints for regular width and regular height using size classes.
Related
I don't know if this is a bug with AutoLayout or Xcode but I've realised that if I run my application on a device which isn't the same size as the device in my storyboard, the elements are adopting the incorrect size.
I.e. Selecting View as iPhone SE and running the application on an iPhone 7+ The size of my tableview is the width of an iPhone SE screen, this fixes itself when I reload the view and then it then adopts the width of the iPhone 7+ screen.
Just a note as well the table view doesn't have a fixed width and is pinned to the top, bottom, left and right with 0 spacing and also I'm changing the height of the cells programmatically in code if this could affect it at all as well.
Video: https://drive.google.com/open?id=0B0QLbDLfJn6_YzljUGg4RTUwaTg
Views that come from a xib (or storyboard) have their IB frame values when they are created, before they are added to the view hierarchy. So a case like you describe is probably that something is accessing a view loaded from a xib before it has become part of the layout process and resized.
This would also explain why it's fixed when you go away and come back. The first time, it got the values before they were final, but the second time the values are already final and correct.
Layout code called fromviewDidLoad() for view controllers, or awakeFromNib() or initWith(coder:) for views is the likely cause. Layout code called from viewDidLoad() is especially problematic because it was fine up to iPhone 5s, but would now cause this problem.
It's impossible to say what exactly the issue just from this. From the NSLog statements visible in the video, the issue is whatever code calls that "weather view width". That is being called too early in the layout process. It needs to go in viewWillAppear or viewWillLayoutSubviews to make sure the correct values are ready for whatever calculation is dependent on that. Hope this helps.
I can't seem to recreate this. I would recommend double checking for any updates for Xcode and the Developer tools (softwareupdate --install -a).
Incase you haven't, restart Xcode.
EDIT: Disregard this answer, please read Mike Sand's post.
Try self.view.layoutIfNeeded in viewDidLoad or in viewWillAppear
seems like Apple change how Interface Builder behaves in Xcode 8? Because when I check hidden in Attributes Inspector on a view in Interface Builder, that view is still visible.
This makes it very tedious to work with views where some views needs to be the view with the highest "z value", the front most view that is.
Is there some other way to show the green view in this example, than to change the order of them to the right (i.e. change their "z value")
In the image below hidden is checked, but I still don't see the green view below. You can download this trivial project at github
When the project is run, the green view is indeed shown, but the issues is that it is annoying when working in Interface Builder.
Am I missing something?
I have the same opinion on it and I also believe that it's annoying. I with they gave you the choice to update the actual storyboard before runtime or not but they didn't so for now we have to deal with it.
There is a quick alternative option though. Hidden will not update in the storyboard but alpha will. If you change the alpha it will update in the storyboard so if you want to see the view behind it just change alpha to 0. You can always change it back easily or if your doing it in code, instead of unhiding your view just change the code so the alpha is set to 1.
How about unchecking the installed checkbox of the red view?
This has also the flaw that you have to remember to reinstall it, but you don't have to change the z-order of your views.
This is deliberate. We wouldn't want a view to be hidden from you, the editor, just because it will be hidden when the app runs. You can easily select a covered view, such as the green view, using Shift-Control-Click on the red view (or use the document outline at the left of your screen shot).
I just updated to Xcode 7.1 and I noticed that all of the prototype cells in my storyboard tableviews are showing as blank and their elements are missing. Sometimes I can see the prototype cells at the top of the tableview, but when I scroll down to view the others all the cells appear blank and white again.
Has anybody else experienced this and is there a quick fix?
Yes, I'm also experiencing this issue.
As a quick workaround, you can set the View Controller simulated size to Freeform, and make it big enough to accomodate all of your custom cells.
Select View Controller
Change its height
Changing it back to Fixed will revert it to the regular size.
Selecting the Table View and selecting the 'size inspector' icon in the 'utilities' pane and ticking the checkbox 'Preserve SuperView Margins' in the 'view' section seems to reset it.
preserve superview margins
However it's not fixing the problem, it worked fine in previous versions and I agree with #matt to file a bug report with Apple
Edited: Seems they fixed it in 7.1.1
Occasionally in my iPad Master/Detail app the Master View slides into view at a full-screen width rather than its usual 320p width. This happens under ios 5 and 6 on iPads 1 and 2. When it happens the view functions normally and the Master view continually reappears at full screen width until the app is restarted. Table view cells are also stretched to full-screen and so they look strange. I have not been able to characterize this except that it may happen only after I have received a memory warning.
There is no place in my code where I try to change the width (or anything else) of the Master view. Has this been seen or reported? I've found no mention of it in my searches. Thx
Do you use Interface Builder to create the views? If so try modifying "Autoresize subviews" attribute in the "Attributes Inspector" of the view
I am hoping someone can help me out with this one. I have an app that I am trying to update to get rid of the letterbox look when running on iPhone 5. I have added a Default-568h#2x.png to the project and the application seems to scale correctly. The splash screen on either device looks correct, however I have a toolbar on my "Home" screen that I can't seem to get in the right place. If I get it right for 5, I can't see it on 4s, and if I get it right for 4s, it is very low on 5.
Am I missing something? Do I need to manually move the toolbar that is at the top? And will I need to move all the controls around on all of the screens in the app?
Any advice is appreciated!
Thanks
Here are some tips on using Interface Builder to handle resizing.
Take advantage of the Simulated Metrics in Interface Builder, as shown here:
To do so, select your top-level View, and open the Attribute Inspector. Then, you can select different sizes and orientations to see how your view responds.
Select the Autosizing options as shown here:
In your case, you want a fixed margin above, but a flexible margin below. Note that this is the opposite of the default for a toolbar because the iOS convention is for toolbars to be at the bottom of the view.
Realize that resizing due to rotation and different screen sizes can often be handled the same way. (Thus, if you handle portrait and landscape orientations using Autosizing, iPhone5 layout usually takes care of itself.)