【问题标题】:Slow animation for the 1st time in iOS deviceiOS 设备第一次出现慢动画
【发布时间】:2012-03-06 13:11:25
【问题描述】:

我正在实现 twitter 应用程序,例如 #Discover 选项卡的动画。当用户点击搜索栏时,navigationBar 消失,tableView 电影向上,并且取消按钮显示在搜索栏上。这是代码...

- (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;
}

这很好用,但仅在我第一次点击搜索栏时延迟大约半秒,之后它很快。 有什么想法吗?

【问题讨论】:

    标签: iphone performance animation tableview searchbar


    【解决方案1】:

    如果您使用 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_;
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2016-03-24
      • 2012-05-01
      • 1970-01-01
      • 1970-01-01
      • 2021-04-05
      • 2020-05-13
      • 1970-01-01
      相关资源
      最近更新 更多