Latest 0.0.4
Homepage https://github.com/lyc59621/JDragonTableManager
License MIT
Platforms ios 7.0, requires ARC
Dependencies UITableView+FDTemplateLayoutCell
Authors

iOS UITableView的DataSource和delegate 优化封装

badge-pod badge-languages badge-platforms badge-mit

user pod


pod 'JDragonTableManager','~> 0.0.3'

基本使用

##Controller 方法
#import "JDragonTableManager.h"
#import "UITableView+JDragonTableManager.h"
@interface UITableViewController ()

@property (weak, nonatomic) IBOutlet UITableView   *aTableView;
@property (nonatomic,strong) JDragonTableManager   *tabDelagate;
@property (nonatomic,strong) JDragonTableManager   *tabDataSource;

@end

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    [self setUIConfig];
}
-(void)setUIConfig
{
    self.aTableView.estimatedRowHeight = 50;
    [self.aTableView registerClass:[aTableViewCell class] forCellReuseIdentifier:@"aTableViewCell"];
    [self.aTableView registerNib:[UINib nibWithNibName:@"bTableViewCell" bundle:nil] forCellReuseIdentifier:@"bTableViewCell"];

    self.tabDelagate = [self.aTableView JDTab_DelegateWithHeaderHeight:10 footerHeight:10 selectBlock:^(NSIndexPath *indexPath) {
    NSLog(@"选中");
    }];
    // 需要实现JDTableManagerDelegate 代理在cell里面
    self.tabDataSource = [self.aTableView JDTab_DataSourceWithSource:@[@"111",@"222"] withTabType:NumberOfRowsInSectionCount withVC:self isSection:true reuseIdentifier:@"aTableViewCell"];
    /*
    //第二种方式,可以不带原数据
    self.tabDataSource = [self.aTableView JDTab_DataSourceWithTabType:NumberOfRowsInSectionCount withVC:self isSection:true reuseIdentifier:@"aTableViewCell"];
    [self.tabDataSource updateReloadData:@[@"111",@"222"]];
    */
}

##Cell方法

#import "JDragonTableManager.h"
@interface aTableViewCell ()<JDTableManagerDelegate>

@end

@implementation aTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
-(void)PrepareToWithAppear:(NSObject *)data WithCurentVC:(UIViewController *)curentVC WithIndexPath:(NSIndexPath *)indexPath
{
    self.textLabel.text = [data isKindOfClass:[NSString class]]?(NSString*)data:data.description;

    NSLog(@"data====%@",data);
}
@end

详细请看demo

Latest podspec

{
    "name": "JDragonTableManager",
    "version": "0.0.4",
    "summary": "iOS UITableView u5c01u88c5",
    "description": "iOS UITableViewu7684DataSourceu548cdelegate u4f18u5316u5c01u88c5",
    "homepage": "https://github.com/lyc59621/JDragonTableManager",
    "license": "MIT",
    "authors": {
        "JDragon": "[email protected]"
    },
    "platforms": {
        "ios": "7.0"
    },
    "source": {
        "git": "https://github.com/lyc59621/JDragonTableManager.git",
        "tag": "0.0.4"
    },
    "source_files": "JDragonTableManager/*.{h,m}",
    "requires_arc": true,
    "dependencies": {
        "UITableView+FDTemplateLayoutCell": [
            "~> 1.6"
        ]
    }
}

Pin It on Pinterest

Share This