简体   繁体   中英

Subview is not resizing with the size changes of superView

I have a superView and I created a new View to use as a subview in my code.

Notify Status View is the superView and Driver InfoView is subView:

通知状态视图是超级视图,驱动信息视图是子视图

But when I make changes to the size of NotifyStatusView, they changes work with every item in superView except Driver Info View: 2 different sizes of the superView:

2 种不同大小的 superView

第二尺寸

The only thing I can think of is that I added the Driver View as a new View and drag and dropped it in to the SuperView.

Just adding the comment as the answer:

you need to call layoutIfNeeded() to tell your view to update the layout changes.

self.view.layoutIfNeeded()

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM