2011-08-08 45 views
0

我目前正在使用iPad並使用Cocos2D。直到現在,我剛剛在處理Game Center時使用默認視圖進行測試。我試圖現在設置它,因爲我想要它,它使用全屏幕或PageSheet(顯示在圖像中)。GKAchievementViewController全屏(或PageSheet)奇數顯示屏

我的問題很簡單(至少在提問中)。爲什麼這樣做呢?我無法弄清楚如何訪問正在超越成就觀點的「木製」框架。

Example image

這是我一直在使用(包括隨機的東西我一直在努力),以獲得一個更大的視圖代碼。

- (void)showAchievements:(id)sender 
{ 
    GKAchievementViewController *achievements = [[GKAchievementViewController alloc] init]; 
    if (achievements != nil) 
    { 
     achievements.achievementDelegate = self; 

     tempVC = [[UIViewController alloc] init]; 
//  tempVC.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal; 

//  tempVC.interfaceOrientation = [[UIDevice currentDevice] orientation]; 

     [achievements shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeLeft]; 
     [achievements shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeRight]; 

     [tempVC shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeLeft]; 
     [tempVC shouldAutorotateToInterfaceOrientation:UIInterfaceOrientationLandscapeRight]; 


//  achievements.navigationController.modalPresentationStyle = UIModalPresentationPageSheet; 
//  tempVC.wantsFullScreenLayout = YES; 
     tempVC.modalPresentationStyle = UIModalPresentationPageSheet; 
     tempVC.view.superview.bounds = CGRectMake(0, 0, winSize.width, winSize.height); 
//  tempVC.view.superview 
//  tempVC.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; 
//  achievements.wantsFullScreenLayout = YES; 
     achievements.modalPresentationStyle = UIModalPresentationPageSheet; 
//  achievements.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; 
     achievements.navigationController.modalPresentationStyle = UIModalPresentationPageSheet; 
//  achievements. = CGRectMake(0, 0, winSize.width, winSize.height); 

     [[[CCDirector sharedDirector] openGLView] addSubview:tempVC.view]; 
     [tempVC presentModalViewController:achievements animated:YES]; 
    } 
} 

我對UIKit的理解非常有限。我使用Cocos2D和Box2D,幾乎沒有其他東西(到目前爲止)。請,任何幫助,你可以提供將非常感激。如果你可以簡單地告訴我如何做到這一點(沒有我擁有的所有垃圾代碼),那將是完美的。

謝謝:)

+0

我問這個,然後變得非常生病了大約一個星期左右,我回來並沒有那麼多的評論。希望一個賞金會給我一個答案:) –

回答

1

我只是試圖與UIModalPresentationPageSheet做到這一點,我看到了同樣的結果,它不只是你。做到這一點的「正確」方式不是改變模態視圖的大小! :)蘋果的UI設計師已經選擇了他們想要的演示風格&大小的成就觀點;最好不要混淆這個,爲了遊戲之間的一致性。

+0

是的,有時我希望我可以打他們的腦袋後面。我打算暫時擱置一會兒,希望能得到解決辦法。 –

+0

我真的不建議嘗試解決它。爲什麼你真的想要繞過他們想要的設計?此外,[文件錯誤](http://bugreport.apple.com)! :) – jtbandes

+0

在iPad上,遊戲套件的模態顯示器非常小巧。使用更多的屏幕會更好。當然,他們的預建視圖(和整個遊戲中心)真的很難看,我認爲只是重新發明輪子,所以我不必展示那個愚蠢的撲克桌主題。 –

0

沒有太多的定製可用於此,您將需要獲取數據並自行顯示,如果你想要的話。

如果您將視圖大小設置爲420x512,則它將正確顯示。

嘗試是這樣的:

 if (UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad) 
    { 
     // The device is an iPad running iPhone 3.2 or later. 

     leaderboardController.view.transform = CGAffineTransformMakeRotation(CC_DEGREES_TO_RADIANS(90.0f)); 
     leaderboardController.view.bounds = CGRectMake(0, 0, 420, 512); 
     //leaderboardController.view.center = CGPointMake(240, 160); 
     leaderboardController.view.center = CGPointMake(364, 512); 
+0

謝謝你試圖幫助,但不幸的是,這似乎並沒有工作。 –

+0

哪部分不起作用?第1行指定了僅執行後面的代碼。然後用幾行來展示如何移動GC排行榜控制器的視圖。適用於某些應用程序。 – whaleshark

+0

視圖的大小不起作用。它只是保持完全相同的大小。我不知道爲什麼。 –