4
votes

I've tried to create custom UIView, which contains another UIView as subview. But when I loaded it with "loadNibNamed", I cannot change the frame size of subview inside the custom view.

Pictures below is how I added the view to the viewcontroller. I still can change some property of subview, but not for the "frame". How can I change the frame size in my custom view ?

Snapshot: enter image description here

1

1 Answers

5
votes

Disable autolayout in MyView.xib. Constraints from XIB file resize redView back.

Go to the File inspector in interface builder, and untick "Use Auto Layout".