2012-10-18 51 views
0

我希望能夠將我的啓動畫面在我的ipad上左右旋轉。 我已經在我的.plist文件中啓用了風景的左右方向。我已經添加了4個文件的LandscapeRight和LandscapeLeft:ipad啓動畫面不旋轉

[email protected]~ipad.png 
[email protected]~ipad.png 
Default-LandscapeRight~ipad.png 
Default-LandscapeLeft~ipad.png 

雖然這不應該的問題,在我的RootViewController的我已經有了:

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

啓動畫面加載,但它不」不要旋轉。 我做錯了什麼?

+0

你可以使用自定義啓動畫面。 –

+0

@SarafarazBabi請詳細。我認爲定義風景左右閃屏是自定義啓動畫面 – Alex

+1

我的意思是你可以創建一個啓動畫面的類並作爲rootviewcontroller傳遞它,並在1或2秒後推動你的家用視圖控制器...並管理閃屏類中的shouldautorotate ...得到它了? –

回答

0

我所知的設備無法識別的取向飛濺Image.These SPLASH圖像持續的時間[email protected]~ipad.png Default-LandscapeLe[email protected]~ipad.png 默認-LandscapeRight〜ipad.png識別應用何時啓動設備,然後設備是否拍攝適當的飛濺圖像。 Default-LandscapeLeft〜ipad.png。

如果你interested.and這只是我的概念罷了

1創建的UIImageView爲了這個目的,它作爲子視圖添加到窗口你可以做的替代解決方案。

2將iamge設置爲該UIIMageView。

3將睡眠方法設置爲3-4秒。像睡覺(4)。

4當調用去RootViewController管理圖像的方向。

像下面的方法 這是方法假設你有定義在AppDelegate類將管理圖像方向。

-(void)checkOrientationforSplash:(UIInterfaceOrientation)interfaceOrentaion 
    { 
if (splashImageView.hidden==FALSE) { 
    if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad){ 
    if (interfaceOrentaion==UIInterfaceOrientationPortrait|| interfaceOrentaion==UIInterfaceOrientationPortraitUpsideDown) { 
     UIImage *image=[UIImage imageNamed:@"Default-Portrait.png"]; 
     splashImageView.frame=CGRectMake(0.0, 0.0, image.size.width, image.size.height); 
     [splashImageView setImage:image]; 

    } 
    else { 
     UIImage *image=[UIImage imageNamed:@"Default-Landscape.png"]; 
     splashImageView.frame=CGRectMake(0.0, 20.0, image.size.width, image.size.height); 
     [splashImageView setImage:image]; 
    } 
     } 

}

5您可以管理應用Instaltion,RoortViewController的月中旬表示,圖像格式。

6刪除在特定點的飛濺圖像。

-(void)removeSplash 
    { 
    [splashImageView setHidden:YES]; 
    } 

我希望它能幫助你。

+0

這是一個好主意!謝謝!順便說一句,我的啓動畫面不啓動它不應該的方式! (也就是說,如果我把它放在正確的位置,它就是一樣的東西,它不會選擇正確的飛濺)。 – Alex