// 导航栏变为透明
[self.navigationController.navigationBar setBackgroundImage:[UIImage new] forBarMetrics:0];
// 让导航条黑线消失的方法
self.navigationController.navigationBar.shadowImage=[UIImage new];
// 根据颜色创建UIImage
+ (UIImage *)createImageFromColor:(UIColor *)color imageSize:(CGSize)size {
CGRect frame = CGRectMake(0, 0, size.width, size.height);
UIGraphicsBeginImageContext(size);
CGContextRef context = UIGraphicsGetCurrentContext();
CGContextSetFillColorWithColor(context, [color CGColor]);
CGContextFillRect(context, frame);
UIImage * image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return image;
}
// 设置导航条下线条
self.navigationController.navigationBar.shadowImage = [UIImage createImageFromColor:Color(188, 188, 188) imageSize:CGSizeMake(KSCREENWIDTH, 1)];
// 使按钮内容居中显示
searchButton.contentHorizontalAlignment = UIControlContentHorizontalAlignmentLeft;
searchButton.titleEdgeInsets = UIEdgeInsetsMake(0, 30, 0, 0);
searchButton.imageEdgeInsets = UIEdgeInsetsMake(0, 10, 0, 0);
//CategoryView 使用
//联动
-(void)initCategoryScrollView:(NSArray *)mArray{
CategoryScrollView * scrollView = [[CategoryScrollView alloc]initWithFrame:CGRectMake(0, -64, KSCREENWIDTH, KSCREENHEIGHT)];
//滚动数据源数组(字符串)
scrollView.titleArr =mArray;
//数据源兼具
scrollView.itemSpace = 10;
//展示数据源数组
// scrollView.dataArr = _dataArr;
//代理
scrollView.delegate =self;
[self.view addSubview:scrollView];
}
////代理方法
//-(void)pushCommoditySubCateogryController:(SubCategory *)subCategory{
//
// [_categoryService getProductBySubCategoryId:subCategory.id successBlock:^(id data, NSString *msg, NSString *code) {
//
// if ([code isEqualToString:@"0"]) {
//
// }else{
// //跳转界面
// SubCategoryController * scc = [[SubCategoryController alloc]init];
//
// scc.productArr = data;
//
// [self.navigationController pushViewController:scc animated:YES];
//
// }
//
// } errorBlock:^(NSError *error) {
//
// }];
//}