-
Notifications
You must be signed in to change notification settings - Fork 0
/
Tweak.xm
42 lines (34 loc) · 1.14 KB
/
Tweak.xm
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
#import <objc/runtime.h>
#import <UIKit/UIKit.h>
%hook UIWindow
- (BOOL)_shouldAutorotateToInterfaceOrientation:(UIInterfaceOrientation)interfaceOrientation
{
if (interfaceOrientation == UIInterfaceOrientationPortraitUpsideDown) {
return NO; //if you want to force portrait use interfaceOrientation = UIInterfaceOrientationPortrait;
}
return %orig(interfaceOrientation);
}
- (BOOL)_shouldAutorotateToInterfaceOrientation:(long long)arg1 checkForDismissal:(BOOL)arg2 isRotationDisabled:(BOOL*)arg3
{
if(arg1 == UIDeviceOrientationPortraitUpsideDown){
return NO; //if you want to force portrait use arg1 = UIInterfaceOrientationPortrait;
}
return %orig(arg1, arg2, arg3);
}
%end
%hook UIDevice
- (void)setOrientation:(UIDeviceOrientation)orientation animated:(BOOL)animated
{
if(orientation == UIDeviceOrientationPortraitUpsideDown){
return; //orientation = UIDeviceOrientationPortrait; to force portrait orientation
}
%orig(orientation, animated);
}
- (void)setOrientation:(long long)arg1
{
if(arg1 == UIDeviceOrientationPortraitUpsideDown){
return; //arg1 = UIDeviceOrientationPortrait; to force portrait orientation
}
%orig(arg1);
}
%end