博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
IOS——定位单元格子视图
阅读量:6910 次
发布时间:2019-06-27

本文共 686 字,大约阅读时间需要 2 分钟。

hot3.png

方法一:

在表格的某行添加按钮时,可以根据一下方法获取到表格的NSIndexPath

- (void)btnClicked:(id)sender event:(id)event{    NSSet *touches = [event allTouches];    UITouch *touch = [touches anyObject];    CGPoint currentTouchPosition = [touch locationInView:[self myTableView]];    NSIndexPath *indexPath = [[self myTableView] indexPathForRowAtPoint:currentTouchPosition];    //do something}
方法二:
- (void)cellBUttonTapped:(id)sender{    UIButton *button = sender;    CGPoint correctedPoint = [button convertPoint:button.bounds.origin toView:self.tableView];    NSIndexPath *indexPath = [self.tableView indexPathForAtPoint:correctedPoint];    NSLog(@"%d",indexPath.row);}

转载于:https://my.oschina.net/orangef/blog/135050

你可能感兴趣的文章
神奇的scanf
查看>>
iptable
查看>>
[python的奇葩事]文件名不能与模块名同名
查看>>
删除win7多余引导项
查看>>
[李景山php]每天TP5-20170104|thinkphp5-File.php-1
查看>>
ehcache作为分布式缓存的研究
查看>>
Mysql for windows (MySQL开发)
查看>>
php测试kafka
查看>>
js获取两个日期之间时间差(天数)
查看>>
Memcached 简介
查看>>
开始考虑程序兼容ESP8266和PYBOARD的问题
查看>>
虚拟化二、Xen虚拟化技术
查看>>
Spring Boot学习--属性配置和使用
查看>>
CentOS 安装 apache
查看>>
Oracle 11g数据库随系统自动启动与关闭的设置方法
查看>>
redhat 桥接配置
查看>>
天猫与九大快递合作 价格热战之后的冷静竞争
查看>>
git pull force
查看>>
scons用户手册
查看>>
使用new操作符来调用一个构造函数的时候发生了什么
查看>>