ios 获取按钮所在的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>>

你可能感兴趣的:(ios 获取按钮所在的cell对象, 注意:ios7 =< System Version < ios8 获取cell对象的区别)