| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -74,6 +74,11 @@ - (void)viewDidLoad { | |||
| 74 | 74 | _dateSource=[NSMutableArray array]; | |
| 75 | 75 | } | |
| 76 | 76 | ||
| 77 | + -(void)viewWillAppear:(BOOL)animated{ | ||
| 78 | + [super viewWillAppear:animated]; | ||
| 79 | + [self resetTableview]; | ||
| 80 | + } | ||
| 81 | + | ||
| 77 | 82 | - (void)didReceiveMemoryWarning { | |
| 78 | 83 | [super didReceiveMemoryWarning]; | |
| 79 | 84 | // Dispose of any resources that can be recreated. | |
@@ -168,8 +173,8 @@ -(void)resetTableview{ | |||
| 168 | 173 | _mySearchDisplayController.searchResultsTableView.height=kScreen_Height-64; | |
| 169 | 174 | } | |
| 170 | 175 | ||
| 171 | - #pragma mark UISearchBarDelegate | ||
| 172 | 176 | ||
| 177 | + #pragma mark UISearchBarDelegate | ||
| 173 | 178 | - (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar | |
| 174 | 179 | { | |
| 175 | 180 | [searchBar insertBGColor:[UIColor colorWithHexString:@"0x28303b"]]; | |
@@ -180,10 +185,24 @@ - (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar | |||
| 180 | 185 | ||
| 181 | 186 | - (BOOL)searchBarShouldEndEditing:(UISearchBar *)searchBar{ | |
| 182 | 187 | [searchBar insertBGColor:[_mySearchDisplayController isActive]?[UIColor colorWithHexString:@"0x28303b"]:nil]; | |
| 188 | + | ||
| 189 | + if(!_isLoading){ | ||
| 190 | + if ([_curSearchStr isEqualToString:_mySearchBar.text]) { | ||
| 191 | + return YES; | ||
| 192 | + } | ||
| 193 | + _isLoading=NO; | ||
| 194 | + _curPage=1; | ||
| 195 | + [self requestPubProjects]; | ||
| 196 | + } | ||
| 183 | 197 | return YES; | |
| 184 | 198 | } | |
| 185 | 199 | ||
| 186 | 200 | - (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar{ | |
| 201 | + _curSearchStr=nil; | ||
| 202 | + if (!_isLoading) { | ||
| 203 | + [_dateSource removeAllObjects]; | ||
| 204 | + [_mySearchDisplayController.searchResultsTableView reloadData]; | ||
| 205 | + } | ||
| 187 | 206 | [searchBar insertBGColor:nil]; | |
| 188 | 207 | } | |
| 189 | 208 | ||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -110,7 +110,7 @@ - (void)viewDidLoad | |||
| 110 | 110 | [searchBar setPlaceholder:@"项目、任务、讨论等"]; | |
| 111 | 111 | UITextField *searchField= [[[[searchBar subviews] firstObject] subviews] lastObject]; | |
| 112 | 112 | [(UIImageView*)[searchField leftView] setFrame:CGRectMake(0, 0, 12, 13)]; | |
| 113 | - [(UIImageView*)[searchField leftView] setImage:[UIImage imageNamed:@"icon_search_searchbar"]]; | ||
| 113 | + // [(UIImageView*)[searchField leftView] setImage:[UIImage imageNamed:@"icon_search_searchbar"]]; | ||
| 114 | 114 | // [searchBar setImage:[UIImage imageNamed:@"icon_search_searchbar"] forSearchBarIcon:UISearchBarIconSearch state:UIControlStateNormal]; | |
| 115 | 115 | [searchBar setTintColor:[UIColor whiteColor]]; | |
| 116 | 116 | [searchBar insertBGColor:[UIColor colorWithHexString:@"0x28303b"]]; | |
| Back | FazBrowse Home | New Git URL |
0 commit comments