Git Product home page Git Product logo

bpinfotableview's Introduction

BPInfoTableview

一个快速构建iOS App个人中心、设置等页面的框架,只需使用UITableView,不需要继承整个UIViewController。不区分 section 和 row,通用写法,可以自行扩展新类型。

使用说明

类型 参数说明
BPRowStylePureTextImage 纯文本图片
BPRowStyleDetailTextAndImage 右侧文本或图片
BPRowStyleDetailTextField 右侧输入框
BPRowStyleDetailSwitch 右侧开关
BPRowStyleCustomView 自定义 view

自定义使用

  1. 新建UITableViewCell继承BPInfoBaseTableViewCell

  2. m 文件重写- (void)setupBaseInfo(初始化控件数据)和- (void)initBaseViews(初始化控件)

  3. 初始化 BPRowItem 传参customClass为新类

使用示例


NSMutableArray* items = [NSMutableArray array];
//初始化数据源
BPRowItem* avatarItem = [[BPRowItem alloc] initWithStyle:BPRowStyleCustomView accessoryType:UITableViewCellAccessoryDisclosureIndicator selectionStyle:UITableViewCellSelectionStyleDefault backgroundColor:nil rowHeight:120 iconName:nil text:nil detailText:nil detailIcon:nil lineStyle:BPBottomLineStyleSolidColor customClass:NSStringFromClass([BPAvatarTableViewCell class])];
[avatarItem setSelectAction:^(BPAvatarTableViewCell* cell) {
//do somthing...
}];
BPRowItem* kidItem = [[BPRowItem alloc] initWithStyle:BPRowStylePureTextImage accessoryType:UITableViewCellAccessoryDisclosureIndicator selectionStyle:UITableViewCellSelectionStyleDefault backgroundColor:nil rowHeight:45 iconName:nil text:@"我的宝宝" detailText:nil detailIcon:nil lineStyle:BPBottomLineStyleSolidColor customClass:nil];
[items addObjectsFromArray:@[ avatarItem, kidItem]];
//初始化 tableView
BPInfoTableView* infoTableView = [[BPInfoTableView alloc] initWithItems:items];
[self.view addSubview:infoTableView];
infoTableView.backgroundColor = BPHEXColor(0xf1f1f1, 1.0f);
self.infoTableView = infoTableView;
[infoTableView mas_makeConstraints:^(MASConstraintMaker* make) {
make.edges.equalTo(self.view);
}];
[infoTableView reloadData];

bpinfotableview's People

Stargazers

xieqi avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.