Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Set size of view in NIB / XIB file

Tags:

ios

xcode5

nib

In Xcode 4, there was a never-quite-fixed bug where Xcode prevented you from resizing views (some silly "Design feature") - you had to make sure you set all the topbar/statusbar/navbar/tabbar to "none" before it would unlock the controls.

XCode 5 appears to have taken this bug ... and extended it!

Now it's completely impossible to edit the size of a UIView in a NIB/XIB file. Nothing I do makes a difference, the dimensions are always readonly. I really, really don't want to write source code (so that our NIB + Storyboards will now always look wrong) to workaround this bug, but I can't find any other way.

Anyone found a workaroind inside Xcode itself?

like image 999
Adam Avatar asked Apr 27 '14 16:04

Adam


People also ask

What is difference between XIB and NIB?

In fact, the acronym "NIB" comes from "NeXTSTEP Interface Builder", and "XIB" from "Xcode Interface Builder". NIBs and XIBs are effectively the same thing: XIBs are newer and are used while you're developing, whereas NIBs are what get produced when you create a build.

Which data format do Xib files use?

Application interface created with Interface Builder, a graphical editor for designing and testing user interfaces; saved in a text-based flat-file format, introduced in Interface Builder 3.0. NOTE: XIB files are also called "development-time format" files.


2 Answers

In the Attributes inspector, in the Simulated Metrics section, change the size to None. This unlocks the view and you can drag to resize it.

EDIT: As noted in the comments below, in more recent versions of Xcode you must set the attribute to Freeform, not None.

like image 159
carl_h Avatar answered Sep 27 '22 15:09

carl_h


There is the solution for XCode 9.0

Select your view and set simulated Metrics as this :

enter image description here

After this, you can edit your view's size :

enter image description here

DEPRECATED :

There is the solution for XCode 8.1

Select your view and set simulated Metrics as this :

enter image description here

After this, you can edit your view's size :

enter image description here

like image 38
Kevin ABRIOUX Avatar answered Sep 27 '22 17:09

Kevin ABRIOUX