获得点击的button所在的cell单元格

自定义cell,button,tableView

UITableView *cell = (UITableView *)[[self.btn superview] superview] ;
NSIndexPath *index = [self.tableView indexPathForCell:cell];
NSLog(@"index is = %li",(long)index.row);

时间: 2024-08-03 20:56:49

获得点击的button所在的cell单元格的相关文章

【大坑】DataGridView多线程更新修改Cell单元格卡死

今天做个小工具,因为最近经常用到DataGridView,所以这次没有选择ListView.忙活了一个小时终于完工了,先运行看看吧.咦!!!!怎么卡死了.代码应该没问题呀,用的多线程也不会卡UI线程呀,打开分析工具查看DataGridView赋值Cell单元格占用CPU达到了80~90,公司的G3260不堪重负的挂掉了. BackgroundWorker解决问题 上园子里找答案,解决办法倒是找到了几种.但是都不靠谱,一样的卡死,看到博问里面说用BackgroundWorker试试.Backgro

ios 获取button所在的cell对象, 注意:ios7 =< System Version < ios8 获取cell对象的差别

ios7 =< System Version< ios8 : ios7 =< System Version < ios8  下 button.superview.superview .superview 是获取按钮所在的cell  NSLog(@"2: cell ---- %@", button.superview.superview.superview); 2014-10-07 10:23:55.583 NeiHanShe[1407:60b] 2: cell

Cell单元格的重用

iOS设备的内存有限,如果用UITableView显示成千上万条数据,就需要成千上万个UITableViewCell对象的话,那将会耗尽iOS设备的内存.要解决该问题,需要重用UITableViewCell对象 重用原理:当滚动列表时,部分UITableViewCell会移出窗口,UITableView会将窗口外的UITableViewCell放入一个对象池中,等待重用.当UITableView要求dataSource返回UITableViewCell时,dataSource会先查看这个对象池,

ios 获取按钮所在的cell对象, 注意:ios8 ios7 获取cell对象的区别

ios7 : ios7 下 button.superview.superview .superview 是获取按钮所在的cell  NSLog(@"2: cell ---- %@", button.superview.superview.superview); 2014-10-07 10:23:55.583 NeiHanShe[1407:60b] 2: cell ---- <RadioCell: 0x155849d0; baseClass = UITableViewCell; f

如何得到自定义UITableViewCell中的按钮所在的cell的indexPath.row

在自定义UITableViewCell中创建了一个按钮. 想在点击该按钮时知道该按钮所在的cell在TableView中的行数.就是cell的 indexPath.row 两种方法都很好.-(IBAction):(id)sender{    NSLog(@"MyRow:%d",[self.table indexPathForCell:((TableViewCell*)[[sender   superview]superview])].row); //这个方便一点点,不用设置tag.  

点击单选button后的文字就可以选定相应单选button

比方我想点击单选button后的文字就选中对应的button: <input type="radio" name="sex" value="1" id="men" /><label >男 </label> <input type="radio" name="sex" value="0" id="women"

gridview中单元格button的点击事件和onitemclick点击冲突及解决办法

如果是listview的onitemclick的点击事件与子button的点击事件冲突,很多人都知道通过对listview设置android:descendantFocusability="blocksDescendants",以及对button设置android:focus="false",来屏蔽button的焦点以及点击事件从而解决冲突.然而不幸的是,本人今天对类似的gridview设置此项属性,亲测并没有什么用. 解决办法是有的,例如把button改为text

Windows中点击“关闭”button发生了什么?

对于Windows操作,当用户点击"关闭"button时,窗体函数就会收到一个WM_DESTROY消息. 窗体函数应该调用PostQuitMessage(0) 向消息队列插入一个WM_QUIT消息.GetMessage 假设从消息队列中取得的是WM_QUIT消息,它将返回0,从而导致消息循环结束,WinMain函数退出,整个应用程序退出. 仅仅要通过点击窗体右上角的"关闭"button,来关闭窗体并退出应用程序.能不能在结束应用程序之前弹出一个对话框,来确认一下我们

IOS 取消表格单元格 TableViewCell 去掉高亮状态 点击Cell取消选择状态

以下是两种实现效果 1. 自定义cell 继承UITableViewCell 重写 -(void)setSelected:(BOOL)selected animated:(BOOL)animated { } -(void)setHighlighted:(BOOL)highlighted animated:(BOOL)animated { } 里面不写任何东西 注意重写的时候一定要有带animated 方法,不然还是无效 2.点击单元格 取消选中单元格 //  点击单元格的时候取消选中单元格 -(