modify ProductList refresh

This commit is contained in:
2014-08-13 11:55:31 +08:00
parent aefb6b1d81
commit 81ebdb021c
4 changed files with 21 additions and 68 deletions
@@ -19,4 +19,5 @@
- (void)footerRereshing;
- (void)headerBeginRefreshing;
- (void)headerEndRefreshing;
- (void)firstRefresh;
@end
@@ -67,6 +67,12 @@
{
[self.tableView headerEndRefreshing];
}
-(void)firstRefresh
{
if (_count <= 0) {
[self headerBeginRefreshing];
}
}
#pragma mark UITableViewDelegate
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView{
return 1;
@@ -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];
}