您的位置:首页 > 其它

从TableviewCell中获得TableviewController的几种方式

2016-04-11 13:10 246 查看
id view = [self superview];

// 获取cell所在的tableview

while (view && [view isKindOfClass:[UITableView class]] == NO) {

view = [view superview];

}

UITableView *tableView = (UITableView *)view;

// 获取tableview的控制器

DTAcountSafeViewController * vc = (DTAcountSafeViewController *)tableView.dataSource;


-(MyView*)initWithController:(CardCreatorViewController*) aController andFrame:(CGRect)aFrame
{
if (self = [super initWithFrame:aFrame])
{
controller = aController;
// more initialisation here
}

return self;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: