2

我正在使用的一些代码使用不推荐使用的方法dismissModalViewControllerAnimated。文档说dismissViewControllerAnimated:completion:现在使用。我不确定这completion:部分。就我而言,完成应该是nil还是NULL什么?

原始代码如下。

- (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];
        }
    }
}
4

1 回答 1

2

如果您不关心完成,请提供一个空块:

[self dismissModalViewControllerAnimated:YES
                              completion:^(void){}];
于 2013-02-22T16:03:54.730 回答