v2ex 下拉刷新 SCRootViewController

SCRootViewController

- (void)loadView {
    [super loadView];
    
    self.tableView                 = [[UITableView alloc] initWithFrame:self.view.frame];
    self.tableView.separatorStyle  = UITableViewCellSeparatorStyleSingleLine;
    self.tableView.delegate        = self;
    self.tableView.dataSource      = self;
    [self.view addSubview:self.tableView];

}
typedef NS_ENUM(NSInteger, UITableViewCellSeparatorStyle) {
    UITableViewCellSeparatorStyleNone,
    UITableViewCellSeparatorStyleSingleLine,
    UITableViewCellSeparatorStyleSingleLineEtched   // This separator style is only supported for grouped style table views currently
};

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    self.title = @"SCPullRefresh";
    
    __weak typeof(SCRootViewController) *weakSelf = self;
    
    self.refreshBlock = ^{
        
        __strong typeof(SCRootViewController) *strongSelf = weakSelf;
        
        [strongSelf performSelector:@selector(endRefresh) withObject:strongSelf afterDelay:2.0];
        
    };
    
    self.loadMoreBlock = ^{
        
        __strong typeof(SCRootViewController) *strongSelf = weakSelf;
        
        [strongSelf performSelector:@selector(endLoadMore) withObject:strongSelf afterDelay:2.0];

    };
    
}


原文地址:https://www.cnblogs.com/pencilCool/p/4760365.html