TestsTested | ✗ |
LangLanguage | Obj-CObjective C |
License | MIT |
ReleasedLast Release | Nov 2017 |
Maintained by hushaohui.
最好用的设置界面和个人信息框架,上至分割线,下到箭头,标题,详细标题,富文本标题等等统统可配置,可更新,你无须判断indexPath.row。也无须纠结如何更新cell,HSSetTableViewController一行代码帮你搞定!100%App都能用到!!目前版本已经升级到1.2.2版本,增加了界面分类功能,你的UIViewController只需要导入UIViewController+HSSetTableView即可。目前支持继承和分类两种实现方式,建议使用分类!
HSBaseCellModel
HSImageCellModel
HSSwitchCellModel
HSTitleCellModel
HSTextCellModel
HSCustomCellModel
HSTitleTableViewCell
HSBaseTableViewCell
HSImageTableViewCell
HSSwitchTableViewCell
HSTextTableViewCell
HSCustomTableViewCell
HSSetTableViewMainController
NSArray+HSSafeAccess
NSBundle+HSImage
NSBundle+HSImage
UIColor+HSExtension
UIView+HSFrame
HSSetTableViewManager
UIViewController+HSSetTableView
#import <UIViewController+HSSetTableView>
或者#import <HSSetTableViewController.h>
HSSetTableViewController
文件夹以及SDWebImage到你工程目录。#import "UIViewController+HSSetTableView"
或者#import "HSSetTableViewController.h"
分类:你的UIViewController只需要调用初始化方法- (void)initSetTableViewConfigure
或者
- (void)initSetTableViewConfigureWithSectionFooter:(NSArray<UIView *> *)footerViewArry footerHeight:(NSArray<NSNumber *> *)footerHeightArry
继承:你的UIViewController只需要继承基类HSSetTableViewMainController即可
//如果是分类,初始化tableView配置。继承则不需要设置
[self initSetTableViewConfigure];
// 1.创建cell title模型
HSTitleCellModel *cell1 = [[HSTitleCellModel alloc] initWithTitle:@"相册" actionBlock:^(HSBaseCellModel *model) {
HSLog(@"点击相册")
}];
photo.icon = [UIImage imageNamed:@"MoreMyAlbum"];
// 2. 创建右边文本显示cell(文本高度自适应)
HSTextCellModel *cell2 = [[HSTextCellModel alloc] initWithTitle:@"文本更新" detailText:@"加班加到口吐二两鲜血" actionBlock:^(HSBaseCellModel *model) {
NSLog(@"文本cell点击事件");
}];
// 3. 创建右边显示开关cell
HSSwitchCellModel *cell3 = [[HSSwitchCellModel alloc] initWithTitle:@"开关控制" switchType:YES switchBlock:^(HSBaseCellModel *model, BOOL on) {
NSLog(@"开关控制 --%d",on);
}];
//4.图片cell
UIImage *placeHolder = [UIImage imageNamed:@"ic_icon_header"];
HSImageCellModel *cell4 = [[HSImageCellModel alloc] initWithTitle:@"图片" placeholderImage:placeHolder imageUrl:@"http://scimg.jb51.net/170405/2-1F40522332a13.jpg" actionBlock:^(HSBaseCellModel *model) {
} imageBlock:^{
}];
cell4.controlRightOffset = 40;
cell4.showArrow = YES;
//5.自定义cell(HSHeaderCellModel必须继承HSCustomCellModel,HSHeaderTableViewCell必须继承HSZhiHuCustomTableViewCell,cellellIdentifier为自定义model绑定的自定义cell,一样的cellellIdentifier说明cell类型是一样,如有不理解请阅读demo)
__weak __typeof(&*self)weakSelf = self;
HSHeaderCellModel *header = [[HSHeaderCellModel alloc] initWithCellIdentifier:@"HSHeaderTableViewCell" actionBlock:^(HSBaseCellModel *model) {
HSHeaderCellModel *hederModel = (HSHeaderCellModel *)model;
hederModel.text = @"奔跑吧,兄弟";
[weakSelf updateCellModel:hederModel];
}];
header.text = @"天霸动霸tuo";
header.cellHeight = 100;
//5.添加到数据源
NSMutableArray *section0 = [NSMutableArray arrayWithObjects:header,cell1,cell2, cell3,cell4,nil];
[self.hs_dataArry addObject:section0];
[self.hs_tableView reloadData];
//6.更新每个cellModel属性后,只需要调用完成刷新
[self updateCellModel:cell4];