我在UIViewController的子视图的角落放了一个按钮 . 现在我想要的是当子视图增加其高度时,按钮应该仍然在角落 . 在设计中我使用autolayout如下:

enter image description here

  • 子视图(左,顶,宽,高)
    子视图的
  • 按钮(左,下,右)
[UIView animateWithDuration:0.3 animations:^{

        //- Increase the subview's height
        CGRect frame = _subview.frame;
        frame.size.height = frame.size.height + 100;
        _subview.frame = frame;

        //- Update constraints
        [_subview layoutIfNeeded];
}];

但按钮仍然是相同的位置 .