2013-04-08 5 views
2

최근에 UIWindow의 하위 클래스 인 사용자 지정 Alert를 만들었습니다. UIViewController이 가로 방향 일 때 경고를 회전하려고합니다. 성공적으로 회전 할 수 있지만 원점이 화면의 왼쪽 상단에 오도록 위치를 변경하는 데 문제가 있습니다. center은 어떤 이유로 아무것도하지 않는 것 설정회전 후 UIWindow 위치 변경

CGRect mainScreenBounds = [[UIScreen mainScreen] bounds]; 
    UIDeviceOrientation deviceOrientation = [[UIApplication sharedApplication] statusBarOrientation]; 
    if (deviceOrientation == UIDeviceOrientationPortrait) 
    { 
     self.frame = CGRectMake(0,0, mainScreenBounds.size.width, mainScreenBounds.size.height); 
    } 
    else 
    { 
     self.frame = CGRectMake(0,0, mainScreenBounds.size.height, mainScreenBounds.size.width); 

     if (deviceOrientation == UIDeviceOrientationLandscapeLeft) 
     { 
      self.transform = CGAffineTransformRotate(self.transform, M_PI/2); 
     } 
     else 
     { 
      self.transform = CGAffineTransformRotate(self.transform, -M_PI/2); 
     } 
     self.center = CGPointMake(self.bounds.size.width/2, self.bounds.size.height/2); 
    } 

: 나는 아래에 다음과 같은 코드가 있습니다. 아무도 내가 여기서 잘못하고있는 것에 대해 어떤 단서를 가지고 있습니까?

답변

-5

응용 프로그램에 둘 이상의 UIWindow가 없어야합니다. 이미 하나 있습니다. 다시 구현, UIView에서 서브 클래 싱.

UIWindow docs : "앱이 외부 장치 화면에 콘텐츠를 표시 할 수있는 경우가 아니면 앱에 하나의 창만 있습니다."

+0

UIAlertView와 같은 상태 표시 줄 위에 배치 할 수 있도록 UIWindow가 필요합니다. –

+0

상태 표시 줄을 없애고 자한다면 – bshirley

+0

사라지 길 원합니다. 경고음이 울리면 화면에 검은 색 음영이 나타납니다. 그게 내가 할 일이고 UIWindow가 필요합니다. –