#import <UIKit/UIKit.h>
#import "SVPullToRefresh.h"
#import "YQZViewController.h"
@interface YQZPullViewController : YQZViewController
{
IBOutlet UITableView *contentTableView;
NSMutableArray *dataSource;
IBOutlet UIView *emptyDataView;
IBOutlet UIImageView* emptyImgView;
IBOutlet UILabel *emptyDataLabel;
int currentPage;
}
@property (nonatomic, strong) IBOutlet UITableView *contentTableView;
@property (nonatomic, strong) IBOutlet UIView *emptyDataView;
@property (nonatomic, strong) IBOutlet UIImageView* emptyImgView;
@property (nonatomic, strong) IBOutlet UILabel *emptyDataLabel;
@property (nonatomic, strong) UISegmentedControl *segmentControl;
//进行中新进展数字标签
@property (nonatomic, strong) UILabel *unFinishedLabel;
//已完成新进展数字标签
@property (nonatomic, strong) UILabel *finishedlabel;
//未读数字标签
@property (nonatomic, strong) UILabel *unReadlabel;
@property (nonatomic, strong) NSMutableArray *dataSource;
@property (nonatomic, assign) int currentPage;
@property (nonatomic, assign) int totalPages;
- (void)insertRowAtTop:(NSArray *)newDatas;
- (void)insertRowAtBottom:(NSArray *)newDatas;
- (void)upRefresh;
- (void)bottomRefresh;
- (void)addSegmentControl;
- (void)addSegmentControlWithArray:(NSArray *)segmentArray;
- (void)addUnReadControl;
- (void)setSegmentNumValue:(NSInteger)unfinishValue finishValue:(NSInteger)finishValue;
- (void)showToast:(NSString *)text;
- (void)resetUIConstraint;
@end
#import "YQZPullViewController.h"
#import "SDWebImageManager.h"
@interface YQZPullViewController ()<UITableViewDataSource, UITableViewDelegate>
@end
@implementation YQZPullViewController
@synthesize contentTableView;
@synthesize emptyDataView;
@synthesize emptyImgView;
@synthesize emptyDataLabel;
@synthesize dataSource;
@synthesize currentPage;
@synthesize totalPages;
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
self.dataSource = [NSMutableArray array];
self.currentPage = 0;
}
return self;
}
- (void)viewDidLoad
{
[super viewDidLoad];
self.contentTableView = [[UITableView alloc] initWithFrame:self.view.frame style:UITableViewStylePlain];
self.contentTableView.delegate = self;
self.contentTableView.dataSource = self;
self.contentTableView.backgroundColor = kYQZLightGrayColor;
[self.view addSubview:self.contentTableView];
__weak YQZPullViewController *weakself = self;
[self.contentTableView addPullToRefreshWithActionHandler:^{
[weakself upRefresh];
}];
// setup infinite scrolling
[self.contentTableView addInfiniteScrollingWithActionH