Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我创建了一个CenterContainerView,其中包含imageViews,在我将imageView添加到CenterContainerView之后,CenterContainerView的子视图会自动对齐到中心,我不知道如何实现它,我想可能是我应该使用autoresizing mask来做到这一点,对?
要将子视图与 superView 的中心对齐,请使用视图的 center 属性。
imageView.center = CenterContainerView.center;
imageView.center = CenterContainerView.center