コントロールセンターのサイズを変更する微調整を書いています。
向きに応じてフレームを設定しようとしています。
これはコードです:
%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 ステートメントに設定されているものでフレームを設定するだけです。私は何を間違っていますか?