2013-02-22 48 views
2

我使用的一些代码使用已弃用的方法dismissModalViewControllerAnimated。该文档说现在使用dismissViewControllerAnimated:completion:。我不确定completion:部分。在我的情况下应该完成nilNULL还是什么?使用dismissViewControllerAnimated:完成:

原始代码如下。

- (void)didFinishWithCamera 
{ 
    [self dismissModalViewControllerAnimated:YES]; 

    if ([self.capturedImages count] > 0) 
    { 
     if ([self.capturedImages count] == 1) 
     { 
      // we took a single shot 
      [self.imageView setImage:[self.capturedImages objectAtIndex:0]]; 
     } 
     else 
     { 
      // we took multiple shots, use the list of images for animation 
      self.imageView.animationImages = self.capturedImages; 

      if (self.capturedImages.count > 0) 
       // we are done with the image list until next time 
       [self.capturedImages removeAllObjects]; 

      self.imageView.animationDuration = 5.0; // show each captured photo for 5 seconds 
      self.imageView.animationRepeatCount = 0; // animate forever (show all photos) 
      [self.imageView startAnimating]; 
     } 
    } 
} 

回答

2

如果你不关心完成,然后提供一个空块:

[self dismissModalViewControllerAnimated:YES 
           completion:^(void){}]; 
+0

所以零不好吗?我认为没有完成是好的。 – 2013-02-23 15:17:58

+0

@WarrenP其实,'nil'看起来确定:http://stackoverflow.com/questions/12445190/dismissmodalviewcontrolleranimated-deprecated – trojanfoe 2013-02-23 15:20:33

+0

在这种情况下,不发射空的完成将是可取的,并且零将永远和无处不在更好。哦,少点标点符号。 – 2013-02-23 15:21:31

相关问题