簡體   English   中英

iOS:我的故事板為橫向,項目設置為橫向,但在模擬器中仍然錯誤

[英]iOS: My storyboard is landscape and project is set to landscape but still wrong in simulator

我想制作一個風景iPad應用程序。 我做了以下三件事。 模擬器的方向是風景,這是正確的。 但是,內容錯了90度,但它們在情節提要圖板視圖中是正確的。 我需要檢查什么嗎?

  1. 我將情節提要設置為風景。

  2. 可能項目我已經設置了“支持的界面方向” =橫向

  3. 在視圖控制器中也使用了以下代碼:

     - (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation { if (interfaceOrientation==UIInterfaceOrientationLandscapeLeft || interfaceOrientation==UIInterfaceOrientationLandscapeRight) return YES; else return NO; } 

支持的接口方向是一回事。 在執行以下操作之前,它對我不起作用:

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

您必須在所有ViewController上使用以下代碼

- (BOOL)shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
        return (interfaceOrientation==UIInterfaceOrientationLandscapeLeft || interfaceOrientation==UIInterfaceOrientationLandscapeRight)
}

確保在Info.plist中也設置了“初始界面方向”。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM