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