Bug in Interface Builder? Safe Area extends past window bounds - ios

I haven’t seen this one before. After switching my simulated device from iPhone SE to iPhone X and back, I found the Safe Area now extends past the edges of the iPhone SE window. (It’s fine when I switch to iPhone X.)
Is this a bug in Interface Builder or something I didn’t previously know about how Safe Area works? Either way, how do I fix this? I’ve tried quitting Xcode (version 9.4.1) and restarting...

Found it. It turns out that I’d used the “Add Missing Constraints” feature along the way someplace -- probably while I was viewing in iPhone X mode -- which added two leading and trailing edge constraints to one of my interior elements. These constraints were too wide when in the iPhone SE mode.
What’s new for me is to discover that the “Safe Area” can be wider than the phone itself. So it might not be a bug, but conceptually it still feels odd to me...

had the same issue but with IPad mode.. deleted the trailing and leading constraints of the main stack view and solved.

Related

Why is the webview screen out of the device area when I'm constrained?

I am a beginner iOS developer. My problem is that when I put constraints, the webview screen is out of the device area. I'm currently using the storyboard based on the iPhone 8. So this is happening on the iPhone SE. It works well when I set AutoResize. However, the constraint leaves the device area. What's the problem? If you don't include any constraints, Warning remains. I want to remove it.
AutoResize It's work!!!!
constraints It's not work!!!!
What am I missing? I can't figure out what the problem is.

Issue with Safe Area - Fine on iPhone X, not on others

So I'm trying to update my app for the iPhone X (a little late to the game, I know), and I enabled safe area, and fixed (supposedly) all my constraints to match. It looks perfect on the iPhone X. But for some reason, on all other iPhones, it still accounts for the iPhone X's notch, despite Safe Area correctly displaying where the UI should start and end. I'm at a loss. None of the constraints in question are hard coded, I set them all to the "standard" value (or so I believe).
storyboard (first button is actually the talk bubble, which is just a static image, second is the paw print, which is an actual button)
messed up iPhone 8 (bubble and ui elements should be at very top and bottom)
Here's my storyboard file: https://ufile.io/35zvs
UPDATE: image for ercell0
You are using standard spacing for top and bottom for your Banner View with a required priority. try setting this to superView: 0 or safeArea: 0 and see if that corrects the issue for you.
The updated view:
Can you change ViewAs from iPhoneX to iPhone8, and attach an image?
Other iphones your are testing on are running iOS11 or older?
If running older versions, safe-area won't be able to help with the alignment. For pre iOS11, use the constraints you were using previously or Layout Anchors.

How To Fit UITableView in the screen with AutoLayout

I am trying to fill the screen with a TableView. I've tried pinning 4 edges but it broke when I view it in different devices (iPad Pro, iPhone SE, landscape and portrait orientation). The TableView is messed up for some reasons. It shouldn't be this hard to fill that in. Did I messed up some settings in my Xcode?
If you ran the application on a real device you'll find it as you expect it to be.
And if you opened another file then came back to storyboard you'll find the preview as expected too, I think it's a bug in the UI Builder.
Note: I'm using Xcode Version 8.3.2.

Horizontal space constraint not working in iPhone 6 Plus only?

So I'm porting my app to adjust for various devices (iPhone 4/4S, iPhone 5/5S, iPhone 6/6P). My app only operates in portrait mode so the constraints and such should be very easy. I have been leveraging the new Xcode 6.2 tools such as the preview tool, and inferred view controller size, so I only have one storyboard for every device. However I have set up all the necessary constraints and the app runs and looks great on all the devices, excluding the iPhone 6P. But what confuses me is that the preview for the iPhone 6P looks exactly what I want, however when I run in the simulator its not correct. Please looks at the images below to understand the problem fully.
The desired look is this: (what it looks like running on all devices except iPhone 6P)
Now what it looks like on the iPhone 6P: (as you can see the tableview is shifted (on both sides) inward.
However as seen in the storyboard, the preview shows it correctly:
This is what the constraints look like in the storyboard:
Hopefully you can understand the problem by now and hope you can offer some help, thanks in advance, feel free to ask for clarification.
As you have confirmed in the comments the issue is that you are constraining to the view margin instead of the view directly.
To stop constraining to a margin for an existing constraint, select it and in the Size inspector uncheck the Relative to marginfor the items.
When creating a new constraint by dragging with control key, holding the alt (option) key while creating constraints will toggle the margin option.
If you are creating it with the popup menu in the lower rigth just uncheck the Constrains to margin

Why is iOS simulator displaying blank screen when I rotate device?

Getting through some introductory swift and playing with Xcode and I basically just have a page with some color squares, background color etc. Doesn't do anything. Problem is when I compile the code it will run in simulator just fine and show everything perfect, BUT when I rotate the device, everything disappears and it only gives me a blank white screen. Rotating right or left does it. The only view that shows it is the original upright view (for all iPhone devices that I tested on through the simulator).
Xcode 6.1.1 and iOS Simulator 8.1 are being used on my MacBook Air with OSX 10.9.5.
In the App general page, I have already checked under Deployment info that Landscape Right and Left are both checked on. Storyboard is set on Any H and Any W.
I'm not sure what I'm doing wrong and it has been pretty difficult searching since I'm still new to iOS development I'm not sure I'm using the right words or whatever because I can't find an answer.
Summary:
App displays properly in iOS Simulator, Portrait View but no other views work and will display blank white screen instead.
In order to see if your views are actually being drawn and just off screen as others have suggested capture the view hierarchy. Go to 'debug' in the menu, then in 'view debugging' click capture view hierarchy. This will pause your app and create a 3D representation of all view on your screen which you can move around by clicking and dragging.
Are your views actually being drawn? If yes are they drawing off screen? If yes then you need to fix your constraints.
It sounds like you haven't set your constraints appropriately. Try setting the top and leading constraints for each of your views to something less than 320 (should cover all device sizes). Fix your warnings, then try again. I believe the views are simply off the screen.
You don't have the correct auto-layout UIConstraints set in interface builder. Check the document outline view in interface builder and ensure that you have appropriate constraints set on each view.
Auto Layout issues occur when you create conflicting constraints, when you don’t provide enough constraints, or when the final layout contains a set of constraints that are ambiguous.
Check this Apple documentation out, it will show you step by step how to resolve your (common) issue.

Resources