self.searchController.searchBar.frame = CGRectMake(self.searchController.searchBar.frame.origin.x,self.searchController.searchBar.frame.origin.y,self.searchController.searchBar.frame.size.width,60);
//
// MySearchBar.m
// WingsBurning
//
// Created by MBP on 16/9/1.
// Copyright © 2016年 leqi. All rights reserved.
//
#import "MySearchBar.h"
#define screenWidth [UIScreen mainScreen].bounds.size.width
@implementation MySearchBar
-(void) layoutSubviews{
[super layoutSubviews];
UIView *searchTextField = nil;
// 经测试, 需要设置barTintColor后, 才能拿到UISearchBarTextField对象
self.barTintColor = [UIColor whiteColor];
searchTextField = [[[self.subviews firstObject] subviews] lastObject];
if([searchTextField isKindOfClass:[UITextField class]]){
searchTextField.frame = CGRectMake(18, 10, screenWidth - 36, 44);
}
}
///>>>>>>>>>>此处注释打开,SearchBar上的取消按钮就隐藏了<<<<<<<<<<<<*
-(void)setShowsCancelButton:(BOOL)showsCancelButton {
}
-(void)setShowsCancelButton:(BOOL)showsCancelButton animated:(BOOL)animated {
}
@end