proximityMonitoringEnabled用于模态呈现的视图控制器

时间:2013-03-01 13:49:49

标签: iphone

UIViewController中,我使用的代码片段完全正常:

- (void)viewWillAppear:(BOOL)animated {

    [super viewWillAppear:animated];

    [UIDevice currentDevice].proximityMonitoringEnabled = YES; 
}

然后我通过执行一个segue检测界面旋转变化,以模态方式呈现另一个UIViewController

- (void)willRotateToInterfaceOrientation:(UIInterfaceOrientation)toInterfaceOrientation duration:(NSTimeInterval)duration {

    if (toInterfaceOrientation == UIInterfaceOrientationLandscapeLeft || toInterfaceOrientation == UIInterfaceOrientationLandscapeRight) {

        [self performSegueWithIdentifier:@"showAnotherView" sender:nil];
    }
}

在这个模态呈现的视图控制器中,我现在正在做同样的事情,我在viewWillAppear:

中启用了邻近监控

不幸的是,这不起作用:当我覆盖iPhone 5的接近传感器时,显示屏没有关闭。

我做错了什么?

0 个答案:

没有答案