iOS 控件定制iOS学习iOS开发进阶

iOS股票表格或课程表

2017-10-18  本文已影响212人  jezz

JJStockView

模仿股票表格和课程表,左右滑动时,标题部分不动,表头和右边内容一起滑动,上下滑动时,表头不动,所有内容一起上下滑动

效果如下

code demo

如何使用

基本上和TableView类似,首先必须实现以下DataSource

@protocol StockViewDataSource <NSObject>

@required
//内容的行数
- (NSUInteger)countForStockView:(JJStockView*)stockView;
//内容左边View
- (UIView*)titleCellForStockView:(JJStockView*)stockView atRowPath:(NSUInteger)row;
//内容右边可滑动View
- (UIView*)contentCellForStockView:(JJStockView*)stockView atRowPath:(NSUInteger)row;
@end

Delegate的所有实现都是可选的:

@protocol StockViewDelegate <NSObject>

@optional
//左上角的固定不动的View
- (UIView*)headRegularTitle:(JJStockView*)stockView;
//可滑动头部View
- (UIView*)headTitle:(JJStockView*)stockView;
//头部高度
- (CGFloat)heightForHeadTitle:(JJStockView*)stockView;
//内容高度
- (CGFloat)heightForCell:(JJStockView*)stockView atRowPath:(NSUInteger)row;
//点击每行事件
- (void)didSelect:(JJStockView*)stockView atRowPath:(NSUInteger)row;
@end

https://github.com/jezzmemo/JJStockView

上一篇 下一篇

猜你喜欢

热点阅读