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);
}
: 나는 아래에 다음과 같은 코드가 있습니다. 아무도 내가 여기서 잘못하고있는 것에 대해 어떤 단서를 가지고 있습니까?
UIAlertView와 같은 상태 표시 줄 위에 배치 할 수 있도록 UIWindow가 필요합니다. –
상태 표시 줄을 없애고 자한다면 – bshirley
사라지 길 원합니다. 경고음이 울리면 화면에 검은 색 음영이 나타납니다. 그게 내가 할 일이고 UIWindow가 필요합니다. –