我正在使用此代码显示排行榜:
-(void)viewscores:(SPEvent*)event
{
tempVC = [[UIViewController alloc] init];
GKLeaderboardViewController* leaderboardController = [[[GKLeaderboardViewController alloc] init] autorelease];
if (leaderboardController != nil)
{
leaderboardController.leaderboardDelegate = self;
UIView *sparrowView = self.stage.nativeView; // take care that self.stage != nil!
[sparrowView addSubview:tempVC.view];
//[tempVC.view addSubview:leaderboardController.view];
[tempVC presentModalViewController:leaderboardController animated:YES];
}
}
- (void)animationDidStop:(NSString*)animationID finished:(BOOL)finished context:(void *)context
{
for(UIView *subview in [tempVC.view subviews]) {
[subview removeFromSuperview];
}
[tempVC.view.superview removeFromSuperview];
[tempVC release];
}
-(void)leaderboardViewControllerDidFinish:(GKLeaderboardViewController*)viewController
{
CGRect frame = viewController.view.frame;
// [tempVC dismissModalViewControllerAnimated:YES];
[UIView beginAnimations:@"curldoup" context:nil];
[UIView setAnimationDelegate:self];
[UIView setAnimationDuration:.5];
[UIView setAnimationDidStopSelector:@selector(animationDidStop:finished:context:)];
// [UIView setAnimationTransition:UIViewAnimationTransitionCurlUp forView:self.stage.nativeView cache:YES];
frame.origin.y = 420;
viewController.view.frame = frame;
[UIView commitAnimations];
//[viewController.view removeFromSuperview];
当我在排行榜上单击完成时,背景变为灰色,应用程序变得混乱。
我非常肯定这是由于以下原因:
frame.origin.y = 420;
由于 iPhone 屏幕是 420。任何人都可以帮我输入正确的数字吗?
任何想法表示赞赏,非常感谢!