xcode 및 ios sdk를 최신 버전 (xcode 4.0/ios sdk 4.3)으로 업그레이드 했으므로 이전에 작성한 프로젝트에서 컴파일러 오류가 발생합니다. Xcode 4로 업그레이드 한 후 컴파일러 오류가 발생했습니다.
이
코드입니다 :- (void)layoutSubviews
{
int w = 320;
int h = 480;
float ver = [[[UIDevice currentDevice] systemVersion] floatValue];
// You can't detect screen resolutions in pre 3.2 devices, but they are all 320x480
if (ver >= 3.2f){
UIScreen* mainscr = [UIScreen mainScreen];
w = mainscr.currentMode.size.width;
h = mainscr.currentMode.size.height;
if(ver >= 4.0f) {
float scaleFactor = mainscr.scale;
// this will scale the OpenGLView for retina screens
self.contentScaleFactor = scaleFactor;
CAEAGLLayer *eaglLayer = (CAEAGLLayer *)self.layer;
eaglLayer.contentsScale=scaleFactor; //new line
}
}
[context renderbufferStorage:GL_RENDERBUFFER_OES fromDrawable:(CAEAGLLayer *)self.layer];
setOpenGLSize(w,h);
[self drawView:nil];
}
그리고 이러한 오류입니다 : 내가에 deplyment 목표를 설정하면 아이폰 OS 3.0 에 내가 자료 SDK는 아이폰 OS 4.3에 잘 살고있다
error: property 'scale' not found on object of type 'UIScreen *' [2]
error: property 'contentScaleFactor' not found on object of type 'EAGLView *' [2]
error: property 'contentsScale' not found on object of type 'CAEAGLLayer *' [2]
및 배포 대상 4.3, 오류 dissapear,하지만 3.0 이상에서 실행하는 응용 프로그램을 원한다.
코드 또는 프로젝트에 어떤 문제가 있습니까?
그냥 웃어서, UIView.h보세요. contentScaleFactor에 커서를 놓고 정의로 건너 뛸 수 있는지 확인하여 Xcode를 사용할 수 있습니다. iOS의 제 버전에서 할 수 있습니다. – ditkin