自定义 UIToolbar 用动画调整大小 [英] Custom UIToolbar resize with animation

查看:36
本文介绍了自定义 UIToolbar 用动画调整大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用这段代码调整自定义 UIToolbar 的大小以更改宽度属性

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?

谢谢

推荐答案

UIViewAnimationOptionLayoutSubviews (iOS > 4.0) 应该可以修复尺寸变化没有被动画化时的问题.

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
];

这篇关于自定义 UIToolbar 用动画调整大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆