Custom UIToolbar resize with animation

。_饼干妹妹 提交于 2020-01-06 05:40:19

问题


i'm using this piece of code to resize my custom UIToolbar to change width property

[UIView animateWithDuration:0.3 delay:0.3 options:0 animations:^{
    self.navToolbar.frame=CGRectMake(0, 0, 200, 30);
} completion:nil];

the code above, change width correctly but without animation, could anyone tell me why?

Thanks


回答1:


UIViewAnimationOptionLayoutSubviews (iOS > 4.0) should fix the problem when the size change is not being animated.

[UIView animateWithDuration:0.3 
        delay:0.3 
        options:UIViewAnimationOptionLayoutSubviews 
        animations:^{
        self.navToolbar.frame=CGRectMake(0, 0, 200, 30);
        }
       completion:nil
];


来源:https://stackoverflow.com/questions/9992864/custom-uitoolbar-resize-with-animation

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!