ios UISearchBar 自动获取焦点
@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]; }
posted on 2016-08-17 11:13 codemaker313 阅读(1236) 评论(0) 编辑 收藏 举报