ios7 获取UITablleViewCell

来源:互联网 发布:linux运行windows程序 编辑:程序博客网 时间:2024/06/05 05:12
iOS7之前UITablleViewCell中得contentView得superView就是UITableViewCell。但是在iOS7得时候,contentView得superView确实UITableViewCellScrollView.UITableViewCellScrollView得superView才是UITableViewCell。考虑到也许之后发生同样得时候,所以如果需要重子View查找指定类型得父视图。考虑使用自定义函数实现
- (UIView*)superviewWithClass:(Class)class child:(UIView*)child
{
UIView *superview = nil;
superview = child.superview;
while (superview != nil && ![superview isKindOfClass:class]) {
superview = superview.superview;
}
return superview;
}
原创粉丝点击