ios UISearchBar 自动获取焦点

时间:2016-08-17 12:13:58   收藏:0   阅读:1938

 

@property (weak, nonatomic) IBOutlet UISearchBar *searchBar;

 

- (void)viewWillAppear:(BOOL)animated
{
    [super viewWillAppear:animated];
    [self performSelector:@selector(setCorrectFocus) withObject:NULL afterDelay:0.8];
}

 

-(void) setCorrectFocus {
    [self.searchBar becomeFirstResponder];
}

 

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!