【问题标题】:I did in all view return no of landscpe orientation but i have to show only one view of spreadsheet in landscape mode how to do it?我确实在所有视图中都没有返回横向,但我必须在横向模式下只显示一个电子表格视图怎么做?
【发布时间】:2012-12-21 06:13:23
【问题描述】:

假设我在应用程序中有多个视图,但我必须在横向模式下只显示电子表格的一个视图如何取悦给我的任何建议。一件事是我在所有视图中都没有返回横向视图请任何人给我知道这对我来说是一种乐趣

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
 {
    return (interfaceOrientation != UIInterfaceOrientationLandscapeLeft);
 }

【问题讨论】:

  • 在需要的视图中保持这样的条件应该自动旋转interfaceOrientation == UIInterfaceOrientationLandscapeLeft

标签: iphone objective-c ios ipad cocoa-touch


【解决方案1】:

如果您使用的是 iOS 6

这两种方法可以在这种情况下为您提供帮助。

1 - 支持的界面方向

- (NSUInteger)supportedInterfaceOrientations
{
    return UIInterfaceOrientationMaskPortrait | UIInterfaceOrientationMaskLandscapeLeft;
}

2 - 演示的首选界面方向

- (UIInterfaceOrientation)preferredInterfaceOrientationForPresentation
{
    return UIInterfaceOrientationLandscapeLeft;
}

【讨论】:

  • 我已经在纵向视图中显示了所有视图,因为我不必在横向视图中显示该视图。所以我必须只做一个视图并且我不工作 ios6 请给我解决方案...
  • 我发布另一个答案试试
  • 在我看来,我也有标签栏,我也必须调整它,所以请告诉我,因为视图是横向旋转,但标签栏和导航栏没有旋转。
  • 将 [self.view setTransform:landscapeTransform] 替换为 [self.navigationController setTransform:landscapeTransform];
  • 这两种方法都没有在我的代码中调用,请给我更好的想法..
【解决方案2】:

在你的 viewWillAppear 中试试这个视图

CGAffineTransform landscapeTransform = CGAffineTransformMakeRotation(degreesToRadian(90));
landscapeTransform = CGAffineTransformTranslate (landscapeTransform, +80.0, +100.0);

[self.view setTransform:landscapeTransform];

【讨论】:

    猜你喜欢
    • 2017-10-05
    • 2014-03-26
    • 2012-02-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多