2012-10-19 3 views
0

iOS6 4 인치 망막 시뮬레이터에서 실행되는 경우 OpenGL 응용 프로그램에서 CAEAGLLayer에 대한 잘못된 경계 정보가 표시됩니다.iPhone 5 CAEAGLLayer가 잘못된 경계를 반환 함

- (id)initWithCoder:(NSCoder*)coder { 


    if ((self = [super initWithCoder:coder])) { 
     // Get the layer 
     CAEAGLLayer *eaglLayer = (CAEAGLLayer *)self.layer; 

     eaglLayer.opaque = YES; 
     eaglLayer.drawableProperties = [NSDictionary dictionaryWithObjectsAndKeys: 
             [NSNumber numberWithBool:NO], kEAGLDrawablePropertyRetainedBacking, kEAGLColorFormatRGBA8, kEAGLDrawablePropertyColorFormat, nil]; 

     printf("layer bounds are: (%f,%f), (%f,%f)\n", eaglLayer.bounds.origin.x, eaglLayer.bounds.origin.y, eaglLayer.bounds.size.width, eaglLayer.bounds.size.height); 

     context = [[EAGLContext alloc] initWithAPI:kEAGLRenderingAPIOpenGLES1]; 

     if (!context || ![EAGLContext setCurrentContext:context]) { 
      [self release]; 
      return nil; 
     } 

     animationInterval = 1.0/60.0; 
    } 
    return self; 
} 

이 창 내용이 다음 위로 이동하고, 0,0 올바른 위치에 더 이상 :

CAEAGLLayer 경계는이 코드에서

layer bounds are: (0.000000,0.000000), (320.000000,480.000000) 

로 인쇄되지 않습니다.

CAEAGLLayer가 잘못된 너비/높이로 설정되는 이유는 누구나 알 수 있습니까?

덕분에

답변

0

아, 다른 사람뿐만 아니라이 문제를 가지고 있었다. 전에 검색 할 때 찾지 못했습니다. 여기에서

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { 

    self.window.frame = CGRectMake(0, 0, [[UIScreen mainScreen]bounds].size.width, [[UIScreen mainScreen]bounds].size.height); 

} 

: How to make a uitableview in interface builder compatible with a 4 inch iPhone

는 솔루션입니다