UIView *naviView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, ScreenWidth, TopHeight)];
naviView.backgroundColor = [UIColor whiteColor];
[self.view addSubview:naviView];
UISearchBar *searchBar = [[UISearchBar alloc] initWithFrame:CGRectMake(20, StateHeight+6, ScreenWidth-90, 32)];
[searchBar setBackgroundImage:[UIImage new]];
searchBar.backgroundColor = HexColor(@"#F5F7F8", 1);
searchBar.layer.cornerRadius = 16;
searchBar.layer.masksToBounds = YES;
searchBar.placeholder = @"搜索关键字";
searchBar.delegate = self;
[naviView addSubview:searchBar];
UITextField *searchTF = [searchBar valueForKey:@"_searchField"];
searchTF.tintColor = Color_Main;
searchTF.textColor = Color_Title;
searchTF.backgroundColor = [UIColor clearColor];
searchTF.font = Font(16);
UIButton *cancelBtn = [[UIButton alloc] initWithFrame:CGRectMake(ScreenWidth-60, StateHeight, 48, 44)];
cancelBtn.titleLabel.font = Font(16);
[cancelBtn setTitle:@"取消" forState:UIControlStateNormal];
[cancelBtn setTitleColor:Color_Main forState:UIControlStateNormal];
[cancelBtn setTitleColor:[UIColor lightGrayColor] forState:UIControlStateHighlighted];
[cancelBtn addTarget:self action:@selector(backAction:) forControlEvents:UIControlEventTouchUpInside];
[naviView addSubview:cancelBtn];
网友评论