How to resize xib file in xcode 6?

I created a new xib file in swift. I want to set a custom size (in points) in the interface builder, but the size elements (height and width) are disabled.

How do I resize it?

Note. I need a specific xib size because I am trying to create a custom Alert View.

+3


source to share


2 answers


You are working under serious delusion. The size of the view in the .xib file has nothing to do with the size at which it will appear when loaded. To set the size at boot, set some property that affects the size at boot time, for example preferredContentSize

.



+4


source


While Matt is correct that you cannot set the final size of the main view of an IB file (we're talking about an IB file that only contains a view), you can resize the view in IB if you need to get an idea of ​​how it will look during execution. This assumes, of course, that you set the correct dimensions at runtime. But it definitely helps to be able to get the size you want by looking at it in IB and then get the sizes from there.

Just select View, navigate to the Attribute inspector: Simulated Metrics → Size: Freeform.



Someone has answered this already here .

+6


source







All Articles