考虑到统一ios6与ios7的界面风格,UISearchBar通过重自定义来实现,重写一个类继承自UISearchBar
1、效果图:

2、部分代码:
附注释说明
1 2 3 4 5 6 7 8 9 10 | SASearchBar.h #import <UIKit/UIKit.h> @interface SASearchBar : UISearchBar @property (nonatomic, strong) UITextField *textField; @property (nonatomic, strong) UIButton *searchBtn; @end |
SASearchBar.m[……]

[……]