I am writing a tweak to change the size of the control center.
I am trying to set the frame depending on the orientation.
This is the code:
%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
But the frame does not change if I switch to landscape mode. It only sets the frame with what is set for the else statement. What am I doing wrong and it there an alternative?