I am using this code to show leader boards:
-(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];
When I click DONE on the leader boards, the background turns gray and the app gets messed up.
I am VERY POSITIVE that this is due to the line:
frame.origin.y = 420;
Since an iPhone screen is 420. Can anyone please assist me on the correct number to put there?
Any ideas appreciated, Thanks a lot!