Ios iPad上的GameCenter登录控制器问题
我正在制作一个通用应用程序,使用GameKit来报告成绩。这在iPhone上运行时效果很好-全屏模式游戏中心视图控制器向上滑动,并在应用程序启动时要求我登录 然而,当我在iPad上运行这个应用程序时,带窗口的iPad版GC view controller会向上滑动,但一旦停止,屏幕就会稍微变灰,我无法与modal view controller或其他任何东西交互 我已将问题缩小到应用程序窗口背景使用的滚动效果,特别是在将动画子层添加到窗口层时:Ios iPad上的GameCenter登录控制器问题,ios,ipad,gamekit,Ios,Ipad,Gamekit,我正在制作一个通用应用程序,使用GameKit来报告成绩。这在iPhone上运行时效果很好-全屏模式游戏中心视图控制器向上滑动,并在应用程序启动时要求我登录 然而,当我在iPad上运行这个应用程序时,带窗口的iPad版GC view controller会向上滑动,但一旦停止,屏幕就会稍微变灰,我无法与modal view controller或其他任何东西交互 我已将问题缩小到应用程序窗口背景使用的滚动效果,特别是在将动画子层添加到窗口层时: -(void)startGridScroll {
-(void)startGridScroll
{
//Create layer and pattern it with the grid image as a color
UIImage * gridImage = [UIImage imageNamed:@"scrolling_grid.png"];
UIColor * gridPattern = [UIColor colorWithPatternImage:gridImage];
CALayer * gridLayer = [CALayer layer];
[gridLayer setZPosition:-1];
gridLayer.backgroundColor = gridPattern.CGColor;
//Transform the image on its Y-axis
gridLayer.transform = CATransform3DMakeScale(1.0, -1.0, 1.0);
gridLayer.anchorPoint = CGPointMake(0.0,1.0);
CGSize scrollSize = self.window.bounds.size;
//Make the layer's frame twice the width of the image
gridLayer.frame = CGRectMake(0.0, 0.0, gridImage.size.width + scrollSize.width, scrollSize.height);
//*******This is the line causing the issue******
[self.window.layer addSublayer:gridLayer];
//Define start position and end coordinates for grid image
CGPoint start = CGPointZero;
CGPoint end = CGPointMake(-gridImage.size.width, 0);
CABasicAnimation *animation = [CABasicAnimation animationWithKeyPath:@"position"];
animation.timingFunction = [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionLinear];
animation.fromValue = [NSValue valueWithCGPoint:start];
animation.toValue = [NSValue valueWithCGPoint:end];
animation.repeatCount = HUGE_VALF;
//Set animation duration and begin
animation.duration = 7.0;
[gridLayer addAnimation:animation forKey:@"position"];
}
我调用此方法两次:最初在应用程序中:didfishlaunchingwithoptions
方法中,以及在applicationdidebecomeactive
方法中。取消一个或另一个电话没有帮助。如果我把它们都注释掉,Game Center登录视图控制器就会向上滑动,工作正常
我假设存在某种与层相关的问题。有什么建议吗?我解决了这个问题。我将滚动效果应用于新UIView的层,然后将其作为子视图添加到应用程序窗口中,而不是将滚动效果层作为直接子层添加到窗口中。仍然不清楚为什么iPad和iPhone的表现有所不同