UISearchBar animation issue

后端 未结 8 1195
迷失自我
迷失自我 2020-12-08 11:22

I have a UIViewController in which I want to show a tableview with the serchBar.

//viewDidLoad
_tableView = [[UITableView alloc] initWithFrame:CGRectMake(0,
          


        
8条回答
  •  -上瘾入骨i
    2020-12-08 11:59

    You can cancel animation by subclassing UISearchDisplayController and adding this:

    - (void)setActive:(BOOL)visible animated:(BOOL)animated
    {
         if(self.active == visible) return;
         [self.searchContentsController.navigationController setNavigationBarHidden:YES animated:NO];
         [super setActive:visible animated:animated];
         [self.searchContentsController.navigationController setNavigationBarHidden:NO animated:NO];
         if (visible) {
              [self.searchBar becomeFirstResponder];
         } else {
              [self.searchBar resignFirstResponder];
         }
    }
    

提交回复
热议问题