利用DTGridView实现横向滚动的tableview
来源:互联网 发布:php安装教程 windows 编辑:程序博客网 时间:2024/05/23 13:10
我们都知道tableview的实现原理,就是创建当前可见个数的tablecell,滚动过程中只是更改不可见的tablecell到可见的位置并且更新数据。这样可以避免滚动很多屏不用创建相应的视图,这样就不会造成内存泄漏。
下面是实现的效果图:
下面是实现的效果图:
下面是实现的代码:
#pragma mark DTGridViewDataSource Methods
- (NSInteger)numberOfRowsInGridView:(DTGridView *)gv {
return 1;
}
- (NSInteger)numberOfColumnsInGridView:(DTGridView *)gv forRowWithIndex:(NSInteger)index {
return 20;
}
- (CGFloat)gridView:(DTGridView *)gv heightForRow:(NSInteger)rowIndex {
return gv.frame.size.height;
}
- (CGFloat)gridView:(DTGridView *)gv widthForCellAtRow:(NSInteger)rowIndex column:(NSInteger)columnIndex {
return gv.frame.size.width;
}
- (DTGridViewCell *)gridView:(DTGridView *)gv viewForRow:(NSInteger)rowIndex column:
(NSInteger)columnIndex {
return gv.frame.size.width;
}
- (DTGridViewCell *)gridView:(DTGridView *)gv viewForRow:(NSInteger)rowIndex column:(NSInteger)columnIndex {
MyTableCell *cell = (MyTableCell *)[gv dequeueReusableCellWithIdentifier:@"cell"];
if (!cell) {
cell = [[[NSBundle mainBundle] loadNibNamed:@"MyTableCell" owner:self options:nil] objectAtIndex:0];
cell.identifier = @"cell";
}
[cell onShowCell];
return cell;
}
#pragma mark DTGridViewDataSource Methods
- (NSInteger)numberOfRowsInGridView:(DTGridView *)gv {
return 1;
}
- (NSInteger)numberOfColumnsInGridView:(DTGridView *)gv forRowWithIndex:(NSInteger)index {
return 20;
}
- (CGFloat)gridView:(DTGridView *)gv heightForRow:(NSInteger)rowIndex {
return gv.frame.size.height;
}
- (CGFloat)gridView:(DTGridView *)gv widthForCellAtRow:(NSInteger)rowIndex column:(NSInteger)columnIndex {
return gv.frame.size.width;
}
- (DTGridViewCell *)gridView:(DTGridView *)gv viewForRow:(NSInteger)rowIndex column:
(NSInteger)columnIndex {
return gv.frame.size.width;
}
- (DTGridViewCell *)gridView:(DTGridView *)gv viewForRow:(NSInteger)rowIndex column:(NSInteger)columnIndex {
MyTableCell *cell = (MyTableCell *)[gv dequeueReusableCellWithIdentifier:@"cell"];
if (!cell) {
cell = [[[NSBundle mainBundle] loadNibNamed:@"MyTableCell" owner:self options:nil] objectAtIndex:0];
cell.identifier = @"cell";
}
[cell onShowCell];
return cell;
}
- 利用DTGridView实现横向滚动的tableview
- 利用DTGridView实现横向滚动的tableview
- 利用DTGridView实现横向滚动的tableview
- 横向滚动的tableview
- 横向TableVIew的实现
- 文字横向滚动的实现
- 文字横向滚动的实现
- iOS之tableView横向滚动
- 横向的TableVIew
- 横向的TableView
- 横向滚动图片,javascript实现的例子
- android 横向滚动文字的实现
- TextView 实现横向滚动的方法
- TextView 横向滚动效果的实现
- Tablayout 横向滚动条的简单实现
- gridview实现横向滚动
- RecyclerView实现横向滚动
- RecyclerView实现横向滚动
- 利用ASIHTTPRequest 发送数据到(新浪微博)以及新浪API Oauth认证
- 免费移动U盘_免费相册_免费通信录
- BI构成意义
- java8大排序
- Intent笔记
- 利用DTGridView实现横向滚动的tableview
- 【转】ACM竞赛中要注意的
- STORZ
- 实用Linux命令(1)目录操作
- iCloud存储原理与部分操作
- Spring和Hibernate整合实现Oracle的大数据类型Clob的操作
- Struts2 action重定向如何传递参数
- 视图后面加with(nolock)后
- 系统分析员、系统架构师、项目经理的区别