程序化不适用

时间:2015-08-30 15:18:45

标签: ios objective-c xcode segue

你如何制作程序化的segue? 我试过这个:

[self performSegueWithIdentifier:@"next" sender:self]; 

但它只给我这个控制台消息:

Snapshotting a view that has not been rendered results in an empty snapshot. 
Ensure your view has been rendered at least once before snapshotting or snapshot after screen updates.

我想要做的是有一个触发图像选择器出现的按钮。当用户选择了图像时,将执行到下一个视图控制器的segue。

2 个答案:

答案 0 :(得分:0)

我没有足够的声誉来添加评论,但如果您尝试呈现UIImagePickerController,我建议您阅读此post

答案 1 :(得分:0)

你可以在显示之前准备segue(假设你已经在故事板中连接了segue并命名了它)(你等待选择器的执行块在执行Segue之前完成)。

 - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender
  {
     // Make sure your segue name in storyboard is the same as this line
    if ([[segue identifier] isEqualToString:@"next"]) {

        NextViewController *vc = [segue destinationViewController];
        // Call anything from the vc

    } 
  }

希望你能得到一些线索。