【问题标题】:How does one sync storyboards, orientation, launch-images and view background images如何同步故事板、方向、启动图像和查看背景图像
【发布时间】:2014-07-16 02:24:09
【问题描述】:

我的目的是初始视图将具有与启动图像相同的背景图像。

为我提供了一种定义纵向和横向启动图像的方法。

但是,如果我使用情节提要,初始视图是纵向的。如果我在它上面为背景图像设置了一个 imageView,如果我从横向开始,它将显示错误。

我在情节提要中哪里有机会在横向和纵向之间进行拆分,以便我可以为两种可能的模式提供两个不同的图像用于同一视图

【问题讨论】:

    标签: ios storyboard


    【解决方案1】:

    有选项:-

    1) 如果 ios 6 你可以使用 autolayout 。 2)你可以单独为uicontrols设置框架,如果ios 6使用这两种方法

    -(BOOL)shouldAutorotate
    {
    return YES;
    }
    - (NSUInteger)supportedInterfaceOrientations
    {
    return UIInterfaceOrientationLandscapeLeft ;//return UIInterfaceOrientationMaskAll;
    }
    

    然后在 ViewDidlOAd() 和 viewWillAppear() 等任何需要的地方执行此操作

    if(UIInterfaceOrientationIsPortrait([UIApplication sharedApplication ]statusBarOrientation))
    {
    // change frames
    }
    else
    {
    // for landscape change frames here
    }
    

    iOS

    - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation // Deprecated in iOS 6.x 
    {
    return UIInterfaceOrientationIsLandscape(interfaceOrientation);
    }
    

    【讨论】:

      【解决方案2】:

      在视图将出现您的初始视图的方法时,检查界面方向并将背景视图相应地替换为您需要显示的任何图像。

      您也可以针对不同的屏幕尺寸(iphone 4 - 5)执行此操作

      【讨论】:

        【解决方案3】:

        如果你允许横向和纵向启动,那么你必须准备两个UIImageView。

        您可以在项目属性中启动时禁用横向。选择构建目标,并取消选中 Deployment Info 部分中的 Landscape Left/Right。

        【讨论】:

          猜你喜欢
          • 1970-01-01
          • 1970-01-01
          • 2015-06-07
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 1970-01-01
          • 2012-09-15
          相关资源
          最近更新 更多