TableView 或者collectionView 获取点击的cell 和当前行数的方法
2016-08-11 09:17
1366 查看
1.第一种方法
- (void)btnActionForUserSetting:(id) sender {
NSIndexPath *indexPath = [self.tableViewindexPathForSelectedRow];
UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
}
2.第二种方法
- (void)deleteCellWithButton:(UIButton *)button {
//1.获取到删除的行数
HDAddDiagnosisTableViewCell *cell = (HDAddDiagnosisTableViewCell *)button.superview.superview;
NSIndexPath *indexPath = [self.tableView
indexPathForCell:cell];
NSLog(@"delete:%ld",(long)indexPath.row);
//2.执行删除操作
}
- (void)btnActionForUserSetting:(id) sender {
NSIndexPath *indexPath = [self.tableViewindexPathForSelectedRow];
UITableViewCell *cell = [self.tableView cellForRowAtIndexPath:indexPath];
}
2.第二种方法
- (void)deleteCellWithButton:(UIButton *)button {
//1.获取到删除的行数
HDAddDiagnosisTableViewCell *cell = (HDAddDiagnosisTableViewCell *)button.superview.superview;
NSIndexPath *indexPath = [self.tableView
indexPathForCell:cell];
NSLog(@"delete:%ld",(long)indexPath.row);
//2.执行删除操作
}
相关文章推荐
- 点击UICollectionViewCell上的UIButton如何获取当前的UICollectionViewCell?
- ios开发之-- tableview/collectionview获取当前点击的cell
- 学习笔记一:UIImage初始化方法以及点击UICollectionView和遇到点击的TableViewCell
- tableView,collectionView如何获取当前cell?
- iOS 获取当前点击的cell相对于self.view的位置
- tableViewcell button点击 获取cell的indexpath 并刷新当前cell
- sharepoint 2010 根据当前url获取列表list或者视图view方法
- [绍棠] 如何获取顶部CollectionView当前显示的cell的indexPath.
- TableView的cell上面加button,实现点击button可以获取到cell的行号或者indexPath
- 在tableView或者collectionView里如何获得被点击的cell的下标位置
- TableView的cell上面加button,实现点击button可以获取到cell的行号或者indexPath
- 在点击tableviewcell之上的东西时获取当前点击的cell的section和row(通过当前点击的坐标点获取)
- iOS中获取用户所点击的位置信息,并通过这个位置信息得到tableView的中的cell的indexPath.section
- 获取UIScrollView当前所在的页面的方法
- 点击OK时View类获取对话框的编辑框的值的方法
- C#获取当前运行的源代码的文件名和当前源代码的行数的方法 分类: .NET 2014-04-20 18:04 327人阅读 评论(0) 收藏
- iOS中如何通过点击UITableViewCell中的Button来获取当前Cell的indexPath
- 点击tableview上的btn 获得它所属于的cell并获得数据源的行数
- Android中通过view方式获取当前Activity的屏幕截图实现方法
- [android] viewpager获取当前view报空指针的解决方法