我想点击搜索栏时显示导航栏

时间:2013-09-12 06:03:52

标签: iphone ios

我使用范围栏创建搜索栏。当我点击搜索栏时,导航栏将被隐藏。搜索栏可以覆盖导航栏。我想在导航栏下面显示搜索栏。我能怎么做?

1 个答案:

答案 0 :(得分:0)

只需将此代码转换为小时即可生效

-(void)searchDisplayControllerDidEndSearch:(UISearchDisplayController *)controller{
    NSLog(@"search cancelled");
    _searchBar.frame=CGRectMake(0, 60, 320, 40);
    _arrButtons=nil;
 [_tableFriendList reloadData];


}
-(void)searchDisplayControllerDidBeginSearch:(UISearchDisplayController *)controller{
    NSLog(@"hey.......");



    _searchBar.frame=CGRectMake(0, 60, 320, 40);
    //_tableFriendList.frame=CGRectMake(0, 140, 320,400);

    [self.navigationController setNavigationBarHidden: NO animated: YES];

    controller.active = YES;

    [self.view addSubview:controller.searchBar];
    [self.view bringSubviewToFront:controller.searchBar];



}