Skip to content

Instantly share code, notes, and snippets.

@wangyangkobe
Created August 12, 2014 13:57
Show Gist options
  • Save wangyangkobe/56f868b6f831675337ec to your computer and use it in GitHub Desktop.
Save wangyangkobe/56f868b6f831675337ec to your computer and use it in GitHub Desktop.
根据UITableViewCell的元素来获取UITableViewCell.(兼容ios7和ios6).
@implementation UIView (KLCPopupExample)
- (UITableViewCell*)parentCell {
// Iterate over superviews until you find a UITableViewCell
UIView* view = self;
while (view != nil) {
if ([view isKindOfClass:[UITableViewCell class]]) {
return (UITableViewCell*)view;
} else {
view = [view superview];
}
}
return nil;
}
@end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment