omz:forum

    • Register
    • Login
    • Search
    • Recent
    • Popular

    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

    Pythonista
    4
    44
    11249
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • stephen
      stephen last edited by

      @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...

      1 Reply Last reply Reply Quote 0
      • stephen
        stephen last edited by

        😂 just found this while looking through my list of view controller members lol

        attentionClassDumpUser_yesItsUsAgain_althoughSwizzlingAndOverridingPrivateMethodsIsFun_itWasntMuchFunWhenYourAppStoppedWorking_pleaseRefrainFromDoingSoInTheFutureOkayThanksBye_
        

        about died

        1 Reply Last reply Reply Quote 0
        • stephen
          stephen last edited by

          😓😴 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

          1 Reply Last reply Reply Quote 0
          • JonB
            JonB last edited by

            Did you implement @mcriley821 's code, along with the alloc().init()? I haven't but mcriley says it works...

            stephen 1 Reply Last reply Reply Quote 0
            • cvp
              cvp last edited by cvp

              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.

              1 Reply Last reply Reply Quote 0
              • stephen
                stephen @JonB last edited by

                @JonB @cvp ya iv been mesing with it for just a min and i cant seem to get it to lock, force rotate or anything lol

                cvp 1 Reply Last reply Reply Quote 0
                • cvp
                  cvp @stephen last edited by

                  @stephen you're right. I don't know how to do and that's the reason why I saidthat I let YOU go on 😅

                  stephen 1 Reply Last reply Reply Quote 1
                  • stephen
                    stephen @cvp last edited by

                    @cvp said:

                    @stephen you're right. I don't know how to do and that's the reason why I saidthat I let YOU go on 😅

                    all good i even tried the one JonB mentioned and nothin

                    1 Reply Last reply Reply Quote 0
                    • JonB
                      JonB last edited by

                      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.

                      stephen 1 Reply Last reply Reply Quote 1
                      • stephen
                        stephen @JonB last edited by

                        @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 my View object? only negative part is the status bar being in the wrong place? if so id say thats a good compromise lol

                        1 Reply Last reply Reply Quote 0
                        • JonB
                          JonB last edited by

                          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_view

                          You can get orientation with a bit of objc, or by using a 1 pixel webview and some JavaScript.

                          stephen 1 Reply Last reply Reply Quote 0
                          • stephen
                            stephen @JonB last edited by

                            @JonB

                            to get orientation if always did:

                            def Orientation():
                            	return PORTRAIT if get_screen_size()[0] < get_screen_size()[1] else LANDSCAPE
                            
                            
                            1 Reply Last reply Reply Quote 0
                            • JonB
                              JonB last edited by

                              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.

                              stephen 1 Reply Last reply Reply Quote 0
                              • stephen
                                stephen @JonB last edited by

                                @JonB

                                awesome thank you! this objc_util stuff is interesting.. lol im starting to get the hang of it. i do want to askmone thing though..

                                ive been using inspect.getmembers() to list fields and methods.. is this good option or is there a better way?

                                1 Reply Last reply Reply Quote 0
                                • JonB
                                  JonB last edited by

                                  https://github.com/jsbain/objc_hacks/blob/master/objc_browser.py

                                  This is a good way to see a complete list of available classes (that is, from loaded frameworks) and their methods. Tapping a method name installs a swizzle to log all calls to that method -- useful for figuring out how to call an omz custom method for instance. Don't tap a method name unless you want said logging.

                                  For viewing instances, your method works. Also, You can use

                                  https://github.com/jsbain/viewbrowser/blob/master/getobjcprops.py

                                  To get all properties/values of an objc instance. There is a table view delegate to show as a table. I probably need to create a workspace browser that ties together the viewbrowser objc oject browsing functionality...

                                  stephen 1 Reply Last reply Reply Quote 1
                                  • stephen
                                    stephen @JonB last edited by

                                    @JonB

                                    Awesome! That would be a wonderful asset 😀

                                    1 Reply Last reply Reply Quote 1
                                    • First post
                                      Last post
                                    Powered by NodeBB Forums | Contributors