Swift3.0 UITableView/UICollectionView默认选中某个 cell
来源:互联网 发布:帖吧爆吧软件 编辑:程序博客网 时间:2024/05/17 03:50
1.tableView
//默认选中的section,rowlet defaultSelectCell = IndexPath(row: 0, section: 0)self.aTableView.selectRow(at: defaultSelectCell, animated: true, scrollPosition: UITableViewScrollPosition.none)
2.CollectionView
let defaultSelectCell = IndexPath(row: 0, section: 0)self.aCollectionView.selectItem(at: defaultSelectCell, animated: true, scrollPosition: UICollectionViewScrollPosition.left)
3.具体使用
先将tableView初始化完毕,后调用此方法将cell移动到选择的位置,在做cell的选择时,不要使用deselectRowAt方法,在选中时刷新cell.
///初始化默认frame convenience init(frame: CGRect,selectRow: Int){ self.init(frame: frame) self.selectedCell = selectRow //默认选中的cell let defaultCell = IndexPath(row: selectedCell, section: 0) //默认选中 self.aTableView.selectRow(at: defaultCell, animated: true, scrollPosition: UITableViewScrollPosition.top)//移动到顶端 }
0 0
- Swift3.0 UITableView/UICollectionView默认选中某个 cell
- UiTableView 默认选中一个cell
- UITableView默认选中一个Cell
- UITableView默认选中第一个cell
- UITableView默认选中第一个cell
- iOS 默认某个cell为选中状态
- iOS UITableView 和 UICollectionView 设置默认选中状态
- uitableview中设置某个cell不能选中,其他可以选
- UITableView 使用 selectRowAtIndexPath 不能默认选中cell的问题
- UITableView使用selectRowAtIndexPath不能默认选中cell的问题
- IOS开发相关07--UITableView默认选中第一个cell
- UITableView选中cell
- UITableView默认选中第一行,以及获取当前选中的cell
- 设置cell默认选中
- UITableView cell 选中变化设置
- UITableView cell 被选中效果
- UITableView和UICollectionView的cell重用问题
- iOS UICollectionView 和 UITableView cell更新 详解
- 湖南省首届逻辑推理大赛 第一环节——争分夺秒
- oracle数据导入另外一个用户下面
- 一头扎进算法导论-堆排序
- 从使用Handler致内存泄漏角度源码追踪Handler工作机制
- oracle通过dblink的方式导出数据
- Swift3.0 UITableView/UICollectionView默认选中某个 cell
- C/C++ Windows API——线程挂起、唤醒与终止
- oracle用户解锁
- HDOJ2012
- android CoordinatorLayout使用
- ubuntu下好玩的一个脚本
- R语言之矩阵操作
- oracle数据库创建dblink
- Itext+JSOUP实现可自定义样式的PDF文件