UISearchBar 搜索框
来源:互联网 发布:mac用什么五笔输入法 编辑:程序博客网 时间:2024/06/02 09:40
UISearchBar 一般配合UITableView使用,当然也可以配合UITextView或者UIWebView使用。
先看他的几个属性:
@property(nonatomic) UIBarStyle barStyle; // default is UIBarStyleDefault (blue)@property(nonatomic,assign) id<UISearchBarDelegate> delegate; // weak reference. default is nil@property(nonatomic,copy) NSString *text; // current/starting search text@property(nonatomic,copy) NSString *prompt; // default is nil@property(nonatomic,copy) NSString *placeholder; // default is nil@property(nonatomic) BOOL showsBookmarkButton; // default is NO@property(nonatomic) BOOL showsCancelButton; // default is NO@property(nonatomic) BOOL showsSearchResultsButton __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_2); // default is NO@property(nonatomic, getter=isSearchResultsButtonSelected) BOOL searchResultsButtonSelected __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_2); // default is NO- (void)setShowsCancelButton:(BOOL)showsCancelButton animated:(BOOL)animated __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0);@property(nonatomic,retain) UIColor *tintColor; // default is nil@property(nonatomic,assign,getter=isTranslucent) BOOL translucent __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0); // Default is NO. Always YES if barStyle is set to UIBarStyleBlackTranslucent// available text input traits@property(nonatomic) UITextAutocapitalizationType autocapitalizationType; // default is UITextAutocapitalizationTypeNone@property(nonatomic) UITextAutocorrectionType autocorrectionType; // default is UITextAutocorrectionTypeDefault@property(nonatomic) UITextSpellCheckingType spellCheckingType; // default is UITextSpellCheckingTypeDefault@property(nonatomic) UIKeyboardType keyboardType; // default is UIKeyboardTypeDefault@property(nonatomic,copy) NSArray *scopeButtonTitles __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0); // array of NSStrings. no scope bar shown unless 2 or more items@property(nonatomic) NSInteger selectedScopeButtonIndex __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0); // index into array of scope button titles. default is 0. ignored if out of range@property(nonatomic) BOOL showsScopeBar __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0); // default is NO. if YES, shows the scope bar. call sizeToFit: to update frame// 1pt wide images and resizable images will be scaled or tiled according to the resizable area, otherwise the image will be tiled@property(nonatomic,retain) UIImage *backgroundImage __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0) UI_APPEARANCE_SELECTOR;@property(nonatomic,retain) UIImage *scopeBarBackgroundImage __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0) UI_APPEARANCE_SELECTOR;
@protocol UISearchBarDelegate <NSObject>@optional- (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar; // return NO to not become first responder- (void)searchBarTextDidBeginEditing:(UISearchBar *)searchBar; // called when text starts editing- (BOOL)searchBarShouldEndEditing:(UISearchBar *)searchBar; // return NO to not resign first responder- (void)searchBarTextDidEndEditing:(UISearchBar *)searchBar; // called when text ends editing- (void)searchBar:(UISearchBar *)searchBar textDidChange:(NSString *)searchText; // called when text changes (including clear)- (BOOL)searchBar:(UISearchBar *)searchBar shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)text __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0); // called before text changes- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar; // called when keyboard search button pressed- (void)searchBarBookmarkButtonClicked:(UISearchBar *)searchBar; // called when bookmark button pressed- (void)searchBarCancelButtonClicked:(UISearchBar *) searchBar; // called when cancel button pressed- (void)searchBarResultsListButtonClicked:(UISearchBar *)searchBar __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_2); // called when search results button pressed- (void)searchBar:(UISearchBar *)searchBar selectedScopeButtonIndexDidChange:(NSInteger)selectedScope __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_3_0);@end
完了。
- UISearchBar 搜索框
- UISearchBar搜索框用法
- iOS搜索框UISearchBar
- UI UISearchBar搜索框
- UISearchBar 搜索框
- UISearchBar 搜索框
- iOS 搜索框之UISearchBar
- iOS中UISearchBar(搜索框)
- UISearchBar搜索
- UISearchBar搜索
- 让UISearchBar搜索框彻底透明
- iOS UISearchBar调整搜索框的颜色
- iOS--UISearchBar 搜索框 的使用方法详细
- iOS中UISearchBar(搜索框)使用总结
- UISearchBar 搜索框 的使用方法详细
- IOS开发----UISearchBar,搜索框的使用
- iOS中UISearchBar(搜索框)使用总结
- UISearchBar(搜索框)的方法属性介绍
- 常用排序算法汇总(C版)
- SuperNotCalledException did not call through to supper onCreate();
- android解析json
- 學校DrCom登錄腳本
- java中定义常量方法
- UISearchBar 搜索框
- BOS中如何扩展标准产品的功能
- C语言读写配置文件
- Andriod 手机控制 Powerpoint 演示(客户端)
- Flip Game
- 二叉树的实现
- Linq to sql(二):DataContext与实体
- 单链表的各种操作
- Linq to sql(三):增删改