• 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 ---- <RadioCell:0x155849d0; baseClass = UITableViewCell; frame = (0 0; 320 70); autoresize = W; layer = <CALayer: 0x1552af80>>

    ios7 =< System Version < ios8 下 button.superview.superview 是获取的不是cell对象

     NSLog(@"2: cell ---- %@", button.superview.superview);

     2014-10-07 10:22:37.993 NeiHanShe[1396:60b] 2: cell ---- <UITableViewCellScrollView:0x17d2d2e0; frame = (0 0; 320 70); autoresize = W+H; gestureRecognizers = <NSArray: 0x17d2d200>; layer = <CALayer: 


     ios8 > System Version || ios7 < System Version :

     ios8 > System Version || ios7 < System Version 下button.superview.superview.superview 获取的是UITableViewWrapperView对象, 所以点击不同cell 但获取的内存相等, 这里就会出问题

     NSLog(@"2: cell ---- %@", button.superview.superview.superview

     2014-10-07 10:27:07.903 NeiHanShe[2791:1186272] 2: cell ---- <UITableViewWrapperView:0x1663bbf0; frame = (0 0; 320 528); gestureRecognizers = <NSArray: 0x1663bb10>; layer = <CALayer: 0x1663bbc0>; contentOffset: {0, 0}; contentSize: {320, 528}>

     2014-10-07 10:27:09.617 NeiHanShe[2791:1186272] 2: cell ---- <UITableViewWrapperView:0x1663bbf0; frame = (0 0; 320 528); gestureRecognizers = <NSArray: 0x1663bb10>; layer = <CALayer: 0x1663bbc0>; contentOffset: {0, 0}; contentSize: {320, 528}>


     ios8 > System Version || ios7 < System Version 下 button.superview.superview 才是获取按钮所在的cell

     NSLog(@"2: cell ---- %@", button.superview.superview);

     2014-10-07 10:20:50.813 NeiHanShe[2775:1184682] 2: cell ---- <RadioCell:0x16ed6a30; baseClass = UITableViewCell; frame = (0 0; 320 70); autoresize = W; layer = <CALayer: 0x16ea5fc0>> 

     2014-10-07 10:20:52.321 NeiHanShe[2775:1184682] 2: cell ---- <RadioCell:0x16ed6b44; baseClass = UITableViewCell; frame = (0 0; 320 70); autoresize = W; layer = <CALayer: 0x16ea5fc0>>

  • 相关阅读:
    FreeRTOS 移植到WIN10
    Keil debug command SAVE 命令保存文件的解析
    VS2017 编译 Visual Leak Detector + VLD 使用示例
    LaTeX 中插入GIF图片
    VS2017 + Qt5 + OpenCV400 环境配置
    记一次C++编程引用obj文件作为静态库文件
    Qt 多语言支持
    vscode 解决符号无法识别的问题
    带FIFO的UART数据接收
    MySQL Connector/Python 接口 (三)
  • 原文地址:https://www.cnblogs.com/gcczhongduan/p/4229204.html
Copyright © 2020-2023  润新知