简体   繁体   中英

subview load from xib,reload view frame, but viewsubviews not change frame

- (void)viewDidLoad {

    self.buttonSubView=(EventbuttonsView *)[[NSBundle mainBundle] loadNibNamed:@"ActionHeadView" owner:nil options:nil][1];

    [self.view addSubview:self.buttonSubView];

    [self.taskStatusRobView mas_makeConstraints:^(MASConstraintMaker *make) {

        make.left.equalTo(self.view);
        make.right.equalTo(self.view);
        make.bottom.equalTo(self.view.mas_bottom).offset(-60);
        make.width.equalTo(self.view.mas_width);
        make.height.equalTo(@60);
    }];

    [self.buttonSubView layoutIfNeeded];

}

buttonSubView is a customview, It's subviews use autolayout , when i call [self.buttonSubView layoutIfNeeded] ,but subviews donot update frame? why? in xib i use update frame, it is ok.but run in iPhone,cannot work?

You should call the layoutIfNeeded method on self.view instead of self.buttonSubView. Hope this help.

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