Skip to content

Commit 44b7eee

Browse files
committed
一些优化~
1 parent 8c297bd commit 44b7eee

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

Coding_iOS/Controllers/ProjectSquareViewController.m

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,14 @@ - (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar
179179
}
180180

181181
- (BOOL)searchBarShouldEndEditing:(UISearchBar *)searchBar{
182-
// [searchBar insertBGColor:[UIColor colorWithHexString:@"0x28303b"]];
183-
[searchBar insertBGColor:nil];
182+
[searchBar insertBGColor:[_mySearchDisplayController isActive]?[UIColor colorWithHexString:@"0x28303b"]:nil];
184183
return YES;
185184
}
186185

186+
- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar{
187+
[searchBar insertBGColor:nil];
188+
}
189+
187190
- (void)searchBarSearchButtonClicked:(UISearchBar *)searchBar{
188191
if ([_curSearchStr isEqualToString:_mySearchBar.text]) {
189192
return;

Coding_iOS/Controllers/RootControllers/Project_RootViewController.m

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -107,10 +107,11 @@ - (void)viewDidLoad
107107
[searchBar.layer setBorderColor:[UIColor whiteColor].CGColor];  //设置边框为白色
108108
[searchBar sizeToFit];
109109
searchBar.delegate = self;
110-
// UITextField *searchField=[[[[searchBar subviews] firstObject] subviews] lastObject];
111-
// [(UIImageView*)searchField.leftView setImage:[UIImage imageNamed:@"icon_seach_searchbar"]];
112-
// [searchBar setImage:[UIImage imageNamed:@"icon_search_searchbar"] forSearchBarIcon:UISearchBarIconSearch state:UIControlStateNormal];
113110
[searchBar setPlaceholder:@"项目、任务、讨论等"];
111+
UITextField *searchField= [[[[searchBar subviews] firstObject] subviews] lastObject];
112+
[(UIImageView*)[searchField leftView] setFrame:CGRectMake(0, 0, 12, 13)];
113+
[(UIImageView*)[searchField leftView] setImage:[UIImage imageNamed:@"icon_search_searchbar"]];
114+
// [searchBar setImage:[UIImage imageNamed:@"icon_search_searchbar"] forSearchBarIcon:UISearchBarIconSearch state:UIControlStateNormal];
114115
[searchBar setTintColor:[UIColor whiteColor]];
115116
[searchBar insertBGColor:[UIColor colorWithHexString:@"0x28303b"]];
116117
[searchBar setHeight:31];

0 commit comments

Comments
 (0)