제어 센터의 크기를 변경하기위한 조정 작업을하고 있습니다.화면이 가로로 표시되지 않는 경우 프레임 설정 iOS
방향에 따라 프레임을 설정하려고합니다.
이
코드입니다 :%hook SBControlCenterContainerView
-(void)layoutSubviews{
%orig;
CGRect screenBounds = [[UIScreen mainScreen] bounds];
if ([[UIDevice currentDevice] orientation] == UIDeviceOrientationLandscapeLeft || [[UIDevice currentDevice] orientation ]== UIDeviceOrientationLandscapeRight){
self.frame = CGRectMake(0, 0, (screenBounds.size.width - 20), 427);
} else {
self.frame = CGRectMake(0, 227, screenBounds.size.width - 20, 427);
}
}
%end
하지만 가로 모드로 전환하면 프레임이 변경되지 않습니다. else 문에 설정된 내용으로 프레임을 설정합니다. 내가 뭘 잘못하고 대체 뭐가 있니?