/LJUserCenter

Custom static cell easyily, Just need to provide the data source。

Primary LanguageObjective-CMIT LicenseMIT

LJUserCenter

License MIT  CocoaPods  Support  Platform  CI Status

Features

  • Custom static cell easyily, Just need to provide the data source。

Installation

With CocoaPods, add this line to your Podfile.

pod 'LJUserCenter', '~> 0.9.0' 

Manually: Drag all files under LJUserCenter/Classes folder into your project.

Screenshots

Usage

If you want to create your own ViewController, simply you only need to subclass from LJUserCenterViewController.

@interface YourCustomViewController : LJUserCenterViewController

@end

realize

- (NSArray *)loadUserCenterDatasource;

you can custom your cell like this

- (NSArray *)loadUserCenterDatasource {
    NSMutableArray *datasource = [NSMutableArray array];
    LJUserCenterCellModel *cellModel11 = [[LJUserCenterCellModel alloc] init];
    cellModel11.title = @"微信号";
    cellModel11.detail = @"123456789";
    NSArray *section1 = @[cellModel11];
    [datasource addObject:section1];
    return datasource;
}

if you want reloadData tableView just to

- (void)reloadUserCenterDatasource;

or if you want to know which cell be Called after the user changes the selection, realize LJUserCenterTableViewCellDelegate(optional) method;

- (void)tableViewCell:(LJUserCenterTableViewCell *)tableViewCell 
        withCellModel:(LJUserCenterCellModel *)cellModel 
          atIndexPath:(NSIndexPath *)indexPath;

for more use, download the project and see the demo

Contributing

Forks, patches and other feedback are welcome.

License

LJUserCenter is released under the MIT license. See LICENSE file for details.

中文介绍

特性

  • 静态cell的定制,只需提供数据源,可以快速的创建同种模式的cell。

用法

继承于LJUserCenterViewController创建自己的控制器

实现以下方法来构造数据源

- (NSArray *)loadUserCenterDatasource;

例如:

- (NSArray *)loadUserCenterDatasource {
    NSMutableArray *datasource = [NSMutableArray array];
    LJUserCenterCellModel *cellModel11 = [[LJUserCenterCellModel alloc] init];
    cellModel11.title = @"微信号";
    cellModel11.detail = @"123456789";
    NSArray *section1 = @[cellModel11];
    [datasource addObject:section1];
    return datasource;
}

当需要刷新数据源时需要实现以下方法

- (void)reloadUserCenterDatasource;

当需要监听cell的点击事件时,需要实现LJUserCenterTableViewCellDelegate代理方法;

- (void)tableViewCell:(LJUserCenterTableViewCell *)tableViewCell 
        withCellModel:(LJUserCenterCellModel *)cellModel 
          atIndexPath:(NSIndexPath *)indexPath;

更多使用,下载项目查看demo

许可证

LJUserCenter 使用 MIT 许可证,详情见 LICENSE 文件。