Latest 1.0.0
Homepage https://github.com/miku1958/MDKSwitchTable
License MIT
Platforms ios 8.0, requires ARC
Authors
a easy way to combine tableviews with a switch tap like android’s taplayout in IOS

Screenshots

image

usage

1、create a swtichTable

MDKSwitchTopSelectViewOption *option = [[MDKSwitchTopSelectViewOption alloc]init];
MDKSwitchTableView *switchTable = [[MDKSwitchTableView alloc]initWithOption:option];

2、if you want to change the property of switch tab view ,you can change the option’s property,like itemTextColor

3、add delegate

switchTable.delegate = self;

4、implement MDKSwitchTableDelegate methods

basically is the same as tableviewDatasource and tableviewDelegate

//MARK: switchTab
- (NSInteger)MDKSwitchNumberOfSection {
    return _midSwitchTitleArr.count;
}
- (NSString *)MDKSwitchTitleOfSectionInHeader:(NSInteger)section {
    return _midSwitchTitleArr[section];
}

- (NSInteger)MDKSwitchTable:(UITableView *)midTable ofIndex:(NSUInteger)index numberOfRowsInSection:(NSInteger)section {
    return _midSwitchDataArr[index].count;
}

//MARK: mid
- (void)MDKSwitchRegisterCellForTable:(UITableView *)midTable ofIndex:(NSUInteger)index {
    [midTable registerClass:[UITableViewCell class] forCellReuseIdentifier:@"UITableViewCell"];
}

- (CGFloat)MDKSwitchTable:(UITableView *)midTable ofIndex:(NSUInteger)index heightForRowAtIndexPath:(NSIndexPath *)indexPath {
    return 50;
}

- (UITableViewCell *)MDKSwitchTable:(UITableView *)midTable ofIndex:(NSUInteger)index cellAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [midTable dequeueReusableCellWithIdentifier:@"UITableViewCell"];
    cell.textLabel.text = _midSwitchDataArr[index][indexPath.row];
    return cell;
}

- (void)MDKSwitchTable:(UITableView *)midTable ofIndex:(NSUInteger)index didSelectRowAtIndexPath:(NSIndexPath *)indexPath {

}

5、if you need a extra headerView,you can reset

switchTable.headerView

Latest podspec

{
    "name": "MDKSwitchTable",
    "version": "1.0.0",
    "summary": "a easy way to use combine tableviews with a switch tap like taplayout",
    "description": "this is a easy way to use combine tableviews with a switch tap like taplayout",
    "homepage": "https://github.com/miku1958/MDKSwitchTable",
    "license": "MIT",
    "authors": {
        "miku1958": "[email protected]"
    },
    "platforms": {
        "ios": "8.0"
    },
    "source": {
        "git": "https://github.com/miku1958/MDKSwitchTable.git",
        "tag": "1.0.0"
    },
    "source_files": "SwitchTableView/**/*.{h,m}",
    "requires_arc": true
}

Pin It on Pinterest

Share This