我使用的一些代码使用了弃用的方法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];
}
}
}
答案 0 :(得分:2)
如果您不关心完成,请提供一个空块:
[self dismissModalViewControllerAnimated:YES
completion:^(void){}];