![](/style/images/good.png)
11
![](/style/images/bad.png)
控件位移动画用NSLayoutConstraint来实现
source link: http://quangelab.com/view-LayoutConstraint-animate/
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
控件位移动画用NSLayoutConstraint来实现 – ruquan.z – github技术博客,成长在于积累。
控件位移动画用NSLayoutConstraint来实现
现在很多项目都用autolayout布局了,如果实现一个空间从左到右的一个切入动画,可以通过设置位置NSLayoutConstraint.constant
来实现,例如
[UIView animateWithDuration:0.5 animations:^{
self.m_pEditLeft.constant = 0.0;
[self.view layoutIfNeeded];
} completion:^(BOOL finished) {
}];
其中必须要调用layoutIfNeeded
才可以,否则没有效果,在此做个笔记。
Written on February 8, 2015
Recommend
About Joyk
Aggregate valuable and interesting links.
Joyk means Joy of geeK