Iphone 首次在iOS设备中播放慢速动画

Iphone 首次在iOS设备中播放慢速动画,iphone,performance,animation,tableview,searchbar,Iphone,Performance,Animation,Tableview,Searchbar,我正在实现类似twitter应用程序的#Discover选项卡动画。当用户点击搜索栏时,导航栏将消失,tableView电影将显示,并且searhbar上会显示取消按钮。这是密码 - (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar { [self.navigationController setNavigationBarHidden:YES animated:YES]; [self.searchBar set

我正在实现类似twitter应用程序的#Discover选项卡动画。当用户点击搜索栏时,导航栏将消失,tableView电影将显示,并且searhbar上会显示取消按钮。这是密码

- (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar
{
    [self.navigationController setNavigationBarHidden:YES animated:YES]; 
    [self.searchBar setShowsCancelButton:YES animated:YES];
    [self.scrollView setContentOffset:CGPointMake(0, 55) animated:YES];
    [self.view addSubview:backImgView];
    return  YES;
}
这工作得很好,但只在我第一次点击搜索栏时延迟了大约半秒,之后就很快了。
有什么想法吗?

我认为如果您使用UISearchDisplayController,您正在寻找或试图编写的动画可以自动完成。UISearchDisplayController通常用于显示结果

UISearchBar *searchBar_ = [[[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)] autorelease]; 

UISearchDisplayController *searchDisplayController_ = [[UISearchDisplayController alloc] initWithSearchBar:searchBar_ contentsController:self] ; 

self.tableView.tableHeaderView = searchBar_;

我认为,如果使用UISearchDisplayController,您正在寻找或试图编写的动画可以自动完成。UISearchDisplayController通常用于显示结果

UISearchBar *searchBar_ = [[[UISearchBar alloc] initWithFrame:CGRectMake(0, 0, 320, 44)] autorelease]; 

UISearchDisplayController *searchDisplayController_ = [[UISearchDisplayController alloc] initWithSearchBar:searchBar_ contentsController:self] ; 

self.tableView.tableHeaderView = searchBar_;