我正在尝试将 ViewController 添加到我的 TableView 单元格中,但是在测试时它没有显示出来。
PhotoLocation 是 UIViewController 的子类。我在 StoryBoard 上创建了一个视图控制器,上面配置了一堆 UILabel、UITextFields、UISwitch 等。PhotoLocation 与该 StoryBoard 视图控制器相关联,其标识符是 PhotoLocation。
在一个单独的控制器 - UITableViewController 中,我有一个工作表视图,其中包含填充各种信息的单元格,我试图将 PhotoLocation VC 添加为每个单元格的子视图。(注意:PhotoLocation 是一个自由格式的 VC,大小为 210x100)。
在我的cellForRowAtIndexPath
方法中,我正在执行以下操作:
// snip code above which sets up the cell and performs various other things
PhotoLocation *photoLocation_ = [self.storyboard instantiateViewControllerWithIdentifier:@"PhotoLocation"];
[photoLocation_.view setFrame:CGRectMake(115, 0, 210, 109)];
[cell.contentView addSubview:photoLocation_.view];
return cell;
当我运行应用程序时,子视图不会显示在单元格中。这里有什么我想念的吗?