Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
iPad Orientation Control help
-
@mcriley821 you're right. I 🤐 and 😰
-
Wow.. ok let me go over this data and ill see what i come up with. im still learning ObjC/Swift. Thank ya'll so much for your input and time im off to crash Pythonista a few times lol i hope we can get this because it would be nice for everyone to have this ability without XCode..
-
Apple said:
@property(nonatomic, readonly) UIInterfaceOrientation preferredInterfaceOrientationForPresentation;
Just to make sure im understanding properly lol..
we use
preferredInterfaceOrientationForPresentation
with 2 or moreUIInterfaceOrientation
set on ourUIViewController
to limit rotation but allowing rotation to differ fromUIStatusBar
. and if we dont set this property it will keep theUIViewController
set to the currentUIInterfaceOrientation
ofUIStatusBar
UIInterfaceOrientation
..Instead of trying to make the View's rotation differ from the status bar. why dont we just control the rotation of
UIStatusBar
itself? or is that where iPadOS has the issue of ontrolling orientation of apps that supports split-screen multitasking. -
@cvp you cannot monkey patch an objc object, without using the objc runtime (swizzleing). Monkey patching just affects calls in python -- when the system calls a selector it doesn't know anything about the python attribute.
There is a way to swizzle in objc, though as I recall, swizzling a single instance is tricky.
-
@stephen wow 🤔🤯🤕🤒
-
@JonB Thanks for your explanation.
-
-
@JonB would you happen to know of any good tutorials/walkthroughs/guides i can checkout on
objc_util
..? im kinda grasping it but there just somthing missing for me to fully take her home... -
😂 just found this while looking through my list of view controller members lol
attentionClassDumpUser_yesItsUsAgain_althoughSwizzlingAndOverridingPrivateMethodsIsFun_itWasntMuchFunWhenYourAppStoppedWorking_pleaseRefrainFromDoingSoInTheFutureOkayThanksBye_
about died
-
😓😴 im at a loss.. i tried:
- setInterfaceOrientation
- shouldAutorotateToInterfaceOrientation
- preferredInterfaceOrientationForPresentation
- viewControllerForRotation().setInterfaceOrientation_
- setModalPresentationStyle
- window_willRotateToInterfaceOrientation
the list goes on for a bit lol
ill get no errors but also nothing changes
-
Did you implement @mcriley821 's code, along with the alloc().init()? I haven't but mcriley says it works...
-
The gist in one of my posts used @mcriley821 's code.
The method works but not what @stephen wants.
Perhaps, the used ViewController is not the good one. -
-
@stephen you're right. I don't know how to do and that's the reason why I saidthat I let YOU go on 😅
-
-
In that case the best option may be to implement a callback on the layout method to re-rotate the view. This could maybe be implemented with a simple Transform.rotate.
-
@JonB said:
In that case the best option may be to implement a callback on the layout method to re-rotate the view. This could maybe be implemented with a simple Transform.rotate.
When I detect a rotation from
ui.View. layout(self)
from the resizing i can just rotate and resize myView
object? only negative part is the status bar being in the wrong place? if so id say thats a good compromise lol -
Im thinking:
Root view - uses flex, to detect layout.
-> rotated_view. Fixed size. Uses a Transform.rotation to back out the orientation.
-> everything else is a subview of rotated_viewYou can get orientation with a bit of objc, or by using a 1 pixel webview and some JavaScript.
-
to get orientation if always did:
def Orientation(): return PORTRAIT if get_screen_size()[0] < get_screen_size()[1] else LANDSCAPE
-
If you want to be able to detect upside down landscape etc, versus just screen size, you'd have to use objc, or a webview and some JavaScript to get the viewport rotation.
In objc,, you can get the view controller, then use
[UIViewController interfaceOrientation]Or,
[[UIDevice currentDevice] orientation]
Or, I believe there is something that grabs the status bar orientation.