不能一个动画的的UISearchBar的框架或边界 [英] Can't animate the frame or bounds of a UISearchBar

查看:167
本文介绍了不能一个动画的的UISearchBar的框架或边界的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想一个动画的UISearchBar的位置,但是当我改变的UISearchBar(中心,阿尔法剂量动画)的框架或bounds属性没有动画效果。

它的iOS SDK 4.2,有没有错误?我很困惑...

I want to animate the position of a UISearchBar, but there's no animate effect when I change the frame or bounds property of UISearchBar(center, alpha dose animate).
It's iOS SDK 4.2, is there a bug? I'm confused...

推荐答案

的问题是,迫使调整其余部分内的搜索栏观点忽略了动画。

The problem is that some inner search bar views forcing the resize to ignore the animation.

这为我工作 -

[UIView animateWithDuration:0.2 animations:^ {
                     [searchBar setFrame:searchBarFrame];
                     [searchBar setNeedsLayout];
                 }];

其中, searchBarFrame - 就是你需要设置一个帧(I保存之前的搜索栏调整第一次)

Where searchBarFrame - is a frame you need to set (I save it before search bar resized first time)

这篇关于不能一个动画的的UISearchBar的框架或边界的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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