FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

优化~ · delegateA/Coding-iOS@76204ac · GitHub

Commit 76204ac

Browse files
committed
优化~
1 parent 44b7eee commit 76204ac

2 files changed

Lines changed: 21 additions & 2 deletions

File tree

‎Coding_iOS/Controllers/ProjectSquareViewController.m‎

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ - (void)viewDidLoad {
7474
_dateSource=[NSMutableArray array];
7575
}
7676

77+
-(void)viewWillAppear:(BOOL)animated{
78+
[super viewWillAppear:animated];
79+
[self resetTableview];
80+
}
81+
7782
- (void)didReceiveMemoryWarning {
7883
[super didReceiveMemoryWarning];
7984
// Dispose of any resources that can be recreated.
@@ -168,8 +173,8 @@ -(void)resetTableview{
168173
_mySearchDisplayController.searchResultsTableView.height=kScreen_Height-64;
169174
}
170175

171-
#pragma mark UISearchBarDelegate
172176

177+
#pragma mark UISearchBarDelegate
173178
- (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar
174179
{
175180
[searchBar insertBGColor:[UIColor colorWithHexString:@"0x28303b"]];
@@ -180,10 +185,24 @@ - (BOOL)searchBarShouldBeginEditing:(UISearchBar *)searchBar
180185

181186
- (BOOL)searchBarShouldEndEditing:(UISearchBar *)searchBar{
182187
[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+
}
183197
return YES;
184198
}
185199

186200
- (void)searchBarCancelButtonClicked:(UISearchBar *)searchBar{
201+
_curSearchStr=nil;
202+
if (!_isLoading) {
203+
[_dateSource removeAllObjects];
204+
[_mySearchDisplayController.searchResultsTableView reloadData];
205+
}
187206
[searchBar insertBGColor:nil];
188207
}
189208

‎Coding_iOS/Controllers/RootControllers/Project_RootViewController.m‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ - (void)viewDidLoad
110110
[searchBar setPlaceholder:@"项目、任务、讨论等"];
111111
UITextField *searchField= [[[[searchBar subviews] firstObject] subviews] lastObject];
112112
[(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"]];
114114
// [searchBar setImage:[UIImage imageNamed:@"icon_search_searchbar"] forSearchBarIcon:UISearchBarIconSearch state:UIControlStateNormal];
115115
[searchBar setTintColor:[UIColor whiteColor]];
116116
[searchBar insertBGColor:[UIColor colorWithHexString:@"0x28303b"]];

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL