new2ios
new2ios

Reputation: 1350

How to resize xib file in xcode 6?

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

How to resize it?

Remark: I need specific size of the xib, because I try to create custom Alert View.

Upvotes: 3

Views: 3466

Answers (2)

HotFudgeSunday
HotFudgeSunday

Reputation: 1403

Although Matt is right that you cannot set the final size of a 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 like at run time. This is, of course, assuming you set the right dimensions at run time. But it definitely helps being able to get the right size you want by looking at it in IB and then getting the dimensions from there.

Just select the View, go to the attributes inspector: Simulated Metrics -> Size : Freeform.

Someone answered this already here.

Upvotes: 6

matt
matt

Reputation: 535201

You are operating under a serious misconception. The size of the view in the .xib file has nothing to do with the size at which it will be shown when it loads. To set the size when it loads, set some property that affects the size at load time, such as preferredContentSize.

Upvotes: 4

Related Questions