0

My parent UIView has a frame (0,0,1024,768).

My subview with the original frame is (0,0,0,0). I add the subview to the parent view and then use PureLayout to spread the subview to fullscreen of the parent view as follow:


CGRect f1 = mySubView.frame; //- (0,0,0,0)

[myParentView addSubView:mySubView];
[mySubView autoPinEdgesToSuperviewEdgesWithInsets:UIEdgeInsetsZero];

CGRect f2 = mySubView.frame; //- (0,0,0,0)

After auto-pin edges to superview, why my subview doesn't change?

Note: I am using ObjectiveC and PureLayout

chipbk10
  • 5,783
  • 12
  • 49
  • 85

1 Answers1

0

Because I need to call method "layoutIfNeeded" after adding the subview:

[myParentView addSubView:mySubView];
[mySubView autoPinEdgesToSuperviewEdgesWithInsets:UIEdgeInsetsZero];
[myParentView layoutIfNeeded];
chipbk10
  • 5,783
  • 12
  • 49
  • 85