UISearchBar animation issue

后端 未结 8 1192
迷失自我
迷失自我 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条回答
  •  [愿得一人]
    2020-12-08 12:21

    codyko gave me an idea. It was the because the navigation bar was no translucent. So I set it to translucent on this view controller and rest when I left with the following code:

    - (void)viewWillDisappear:(BOOL)animated {
        [super viewWillDisappear:animated];
        self.navigationController.navigationBar.translucent = NO;
    }
    
    - (void)viewWillAppear:(BOOL)animated {
        [super viewWillAppear:animated];
        self.navigationController.navigationBar.translucent = YES;
    }
    

    Now that left the navigation bar on this controller slightly faded, so I added a UIView the same color as my navbar just behind it to make it look opaque. I know it isn't perfect but it works nicely.

提交回复
热议问题