for (UIView *subview1 in self.navigationController.navigationBar.subviews) {
// ZYLog(@”%@”,[subview1 class]);
if ([subview1 isKindOfClass:NSClassFromString(@”_UIBarBackground”)]) {
UIView subview = (UIView )subview1;
// [subview.subviews[1] removeFromSuperview];
// UIImageView imageView = (UIImageView )subview.subviews[0];
// self.navigationBarBackgroundView = imageView;
for (UIView *subview2 in subview.subviews) {
// [subview2 removeFromSuperview];
}
}
}
UISearchBar *searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(0, 8, 245, 28)];
searchBar.placeholder = @"精品推荐";
searchBar.delegate = self;
self.navigationItem.titleView = searchBar;
[searchBar setBackgroundImage:[UIImage new]];
[searchBar setTranslucent:YES];
//修改搜索框背景
searchBar.backgroundColor=[UIColor clearColor];
for (UIView *subview1