Search code examples
iosxcodeinterface-builderxib

Why does any UIView that I drag into a xib file turn into an iPhone XR?


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.

Screenshot of View 2 nested in 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.

Screenshot of View 1 and View 2 as top-level views

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?


Solution

  • 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):

    Position of the "View as:" panel

    "View as:" panel

    To change the size of a top-level UIView, follow this guide.