How to block custom UView size assignment

I am creating a customIndicator. I wanted it to behave like a UIActivityIndicatorView , but with different animations.

When you place a UIActivityIndicatorView on a Storyboard, the width and height of this view are locked for modification (grayed out).

There is no problem to make a fixed width for the view in code, but is it possible to make a custom view in the same way as a UIActivityIndicatorView : with the width and height highlighted in the storyboard?

+7
ios uiview uicontrol uistoryboard
source share
2 answers

Thorax, have a nice day!

Well, I found the answer to your question here !

Although 1.5 years ago, I don’t think something has changed.

+3
source share

I don't know how to align width and height, but there is a way to avoid setting width and height restrictions all the time in IB: you should just override intrinsicContentSize () in your subclass of UIView. For example, in Swift:

 override func intrinsicContentSize() -> CGSize { return CGSizeMake(50, 50) } 
0
source share

All Articles