首页 > 其他 > 详细

对约束的视图约束变化动画处理

时间:2015-09-09 16:43:00      阅读:220      评论:0      收藏:0      [点我收藏+]

有时候我们为了用户体验需要对约束的视图执行动画, 如下:

    [UIView animateWithDuration:0.3 animations:^{

        self.mButtomViewLayoutH.constant =  44;

        [self.mButtomView setNeedsLayout];

    }];

对self.mButtomView执行0.3秒的动画, 运行发现, 然并卵!  那怎么解决呢? 继续看...

原因在于你设置完视图后并没有通知父视图刷新约束. 所以你如下设置OK.

    [UIView animateWithDuration:0.3 animations:^{

        self.mButtomViewLayoutH.constant =  44;

        [self.mButtomView setNeedsLayout];

        [self.view layoutIfNeeded];

    }];

对约束的视图约束变化动画处理

原文:http://www.cnblogs.com/Milo-CTO/p/4794769.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!