我试图保留UITableViewcontroller纵向。因此,我不想旋转到横向模式。我在下面添加了方法。但它并没有帮助,请注意,我使用的是iOS 8:禁用UITableViewcontroller从横向旋转(保持纵向)
- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
// Return YES for supported orientations
if(interfaceOrientation== UIInterfaceOrientationPortrait)
{
return YES;
}else
{
return NO;
}
}
注意:我通过调用的UITableView UINavigationController的
UINavigationController *navigationController = [[UINavigationController alloc]
initWithRootViewController:svc];
// configure the new view controller explicitly here.
[self presentViewController:navigationController animated:YES completion: nil];
...谢谢,但它仍然在旋转......注意我正在使用故事板,这样做有什么区别。 – user836026 2014-11-21 17:31:46
不,不应该这样做。在这些方法中添加断点以确保它们被调用。 – 2014-11-21 17:53:40
哦,只是注意到你的'UINavigationController'的更新。当'visibleViewController'是你的表视图控制器时,你需要子类* that *并覆盖这些方法以返回'portrait'。 – 2014-11-21 17:56:15