remykits
remykits

Reputation: 1775

how to align subviews to the center of parent view?

I create a CenterContainerView, which contains imageViews, after I add an imageView to CenterContainerView, the subviews of CenterContainerView are automatically aligned to center, I don't know how to implement it, I think may be I should use autoresizing mask to do it, right?

Upvotes: 1

Views: 3899

Answers (1)

Anupdas
Anupdas

Reputation: 10201

To align subviews to the center of superView use the center property of a view.

imageView.center = CenterContainerView.center;

Upvotes: 7

Related Questions