コントロールセンターのサイズを変更するための調整を行っています。ランドスケープで機能していない場合のフレームの設定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文に設定されているものだけでフレームを設定します。私は間違って何をしていますか?