'dismissModalViewControllerAnimated:'已弃用

时间:2013-05-21 03:38:54

标签: ios uiviewcontroller

我知道已经问过question,但是如何解决问题referringline

 -(void) achievementViewControllerDidFinish:(GKAchievementViewController *)viewController
{
    AppController *app = (AppController*) [[UIApplication sharedApplication] delegate];
    [[app navController] dismissModalViewControllerAnimated:YES];
}

指的是[[app navController] dismissModalViewControllerAnimated:YES]; 'dismissModalViewControllerAnimated:' is deprecated in iOS 6.0

2 个答案:

答案 0 :(得分:2)

如果在单击XCode中的方法时按ALT,则可以查看有关该方法的更多信息,包括可用性。在“可用性”部分中,它将建议在不推荐使用当前方法时使用的方法。对于dismissModalViewControllerAnimated:,建议使用dismissViewControllerAnimated:completion:。所以你可以用后者替换它,完成参数为nil。

enter image description here

答案 1 :(得分:0)

iOS 5.0+是

- (void)dismissViewControllerAnimated:(BOOL)flag completion:(void (^)(void))completion

你可以通过Nil"完成"