首页 > 其他 > 详细

从TableviewCell中获得TableviewController的几种方式

时间:2016-04-11 14:14:27      阅读:294      评论:0      收藏:0      [点我收藏+]

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;
}

 

从TableviewCell中获得TableviewController的几种方式

原文:http://www.cnblogs.com/heyode/p/5377934.html

(0)
(0)
   
举报
评论 一句话评论(0
关于我们 - 联系我们 - 留言反馈 - 联系我们:wmxa8@hotmail.com
© 2014 bubuko.com 版权所有
打开技术之扣,分享程序人生!