2013-02-22 82 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

相關問題