码迷,mamicode.com
首页 > 其他好文 > 详细

搜索框UISearchBar

时间:2016-06-19 12:52:27      阅读:129      评论:0      收藏:0      [点我收藏+]

标签:

1\初始化    

UISearchBar *searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(10, 20, 200, 30)];

    [self.view addSubview:searchBar];

    searchBar.delegate = self;

2\实现代理方法

-(BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar {

    NSLog(@"开始编辑");

    [self presentViewController:[[redViewController alloc] init] animated:YES completion:nil];

    return YES;

}

 

 

-(void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText {

    NSLog(@"改变了");

}

 

搜索框UISearchBar

标签:

原文地址:http://www.cnblogs.com/making/p/5597711.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!