diff --git a/ManagerDemo.xcworkspace/xcuserdata/xmfish.xcuserdatad/UserInterfaceState.xcuserstate b/ManagerDemo.xcworkspace/xcuserdata/xmfish.xcuserdatad/UserInterfaceState.xcuserstate index 4bcd278..765ea4f 100644 Binary files a/ManagerDemo.xcworkspace/xcuserdata/xmfish.xcuserdatad/UserInterfaceState.xcuserstate and b/ManagerDemo.xcworkspace/xcuserdata/xmfish.xcuserdatad/UserInterfaceState.xcuserstate differ diff --git a/ManagerDemo/MainView/ListView/ListViewController.h b/ManagerDemo/MainView/ListView/ListViewController.h index 7cc88a4..715c94b 100644 --- a/ManagerDemo/MainView/ListView/ListViewController.h +++ b/ManagerDemo/MainView/ListView/ListViewController.h @@ -19,4 +19,5 @@ - (void)footerRereshing; - (void)headerBeginRefreshing; - (void)headerEndRefreshing; +- (void)firstRefresh; @end diff --git a/ManagerDemo/MainView/ListView/ListViewController.m b/ManagerDemo/MainView/ListView/ListViewController.m index 7853216..82e1c55 100644 --- a/ManagerDemo/MainView/ListView/ListViewController.m +++ b/ManagerDemo/MainView/ListView/ListViewController.m @@ -67,6 +67,12 @@ { [self.tableView headerEndRefreshing]; } +-(void)firstRefresh +{ + if (_count <= 0) { + [self headerBeginRefreshing]; + } +} #pragma mark UITableViewDelegate -(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{ return 1; diff --git a/ManagerDemo/MainViewControll/ProductListViewController.m b/ManagerDemo/MainViewControll/ProductListViewController.m index ca6509d..58c9270 100644 --- a/ManagerDemo/MainViewControll/ProductListViewController.m +++ b/ManagerDemo/MainViewControll/ProductListViewController.m @@ -12,10 +12,7 @@ #import "OtherListViewController.h" @interface ProductListViewController () { - LoanListViewController* _loanListViewController; - FundListViewController* _fundListViewController; - OtherListViewController* _otherListViewController; - + NSArray* listViewContrllerArray; //界面列表 NSInteger _nowSelectTab; //当前选择的界面。 } @@ -29,12 +26,13 @@ self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // Custom initialization - _loanListViewController = [[LoanListViewController alloc] initWithNibName:@"ListViewController" bundle:nil]; - _loanListViewController.title = @"列表1"; - _fundListViewController = [[FundListViewController alloc] initWithNibName:@"ListViewController" bundle:nil]; - _fundListViewController.title = @"列表2"; - _otherListViewController = [[OtherListViewController alloc] initWithNibName:@"ListViewController" bundle:nil]; - _otherListViewController.title = @"列表3"; + LoanListViewController* loanListViewController = [[LoanListViewController alloc] initWithNibName:@"ListViewController" bundle:nil]; + loanListViewController.title = @"列表1"; + FundListViewController* fundListViewController = [[FundListViewController alloc] initWithNibName:@"ListViewController" bundle:nil]; + fundListViewController.title = @"列表2"; + OtherListViewController* otherListViewController = [[OtherListViewController alloc] initWithNibName:@"ListViewController" bundle:nil]; + otherListViewController.title = @"列表3"; + listViewContrllerArray = @[loanListViewController, fundListViewController, otherListViewController]; _nowSelectTab = 0; } return self; @@ -61,19 +59,8 @@ #pragma mark method -(void)rightBarBtnClick:(id)sender { - switch (_nowSelectTab) { - case 0: - [_loanListViewController headerBeginRefreshing]; - break; - case 1: - [_fundListViewController headerBeginRefreshing]; - break; - case 2: - [_otherListViewController headerBeginRefreshing]; - break; - default: - break; - } + //刷新. + [(ListViewController*)[listViewContrllerArray objectAtIndex:_nowSelectTab] headerBeginRefreshing]; } #pragma mark - 滑动tab视图代理方法 @@ -81,36 +68,13 @@ - (NSUInteger)numberOfTab:(QCSlideSwitchView *)view { // you can set the best you can do it ; - return 3; + return listViewContrllerArray.count; } - (UIViewController *)slideSwitchView:(QCSlideSwitchView *)view viewOfTab:(NSUInteger)number { - UIViewController* viewController = nil; - switch (number) { - case 0: - { - viewController = _loanListViewController; - - } - break; - case 1: - { - viewController = _fundListViewController; - } - break; - case 2: - { - viewController = _otherListViewController; - } - break; - - default: - break; - } - return viewController; - + return [listViewContrllerArray objectAtIndex:number]; } @@ -118,26 +82,8 @@ { DLog(@"%ld",number); _nowSelectTab = number; - switch (number) { - case 0: - if (_loanListViewController.count <= 0) { - [_loanListViewController headerBeginRefreshing]; - } - break; - case 1: - if (_fundListViewController.count <= 0) { - [_fundListViewController headerBeginRefreshing]; - } - break; - case 2: - if (_otherListViewController.count <= 0) { - [_otherListViewController headerBeginRefreshing]; - } - break; - - default: - break; - } + //进行第一次刷新 + [(ListViewController*)[listViewContrllerArray objectAtIndex:number] firstRefresh]; }