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.


    objc nil?

    Pythonista
    2
    3
    1537
    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.
    • JonB
      JonB last edited by

      in the beta ctypes/objc_utils module, is there a way to send nil as a selector argument? i was trying to use locationOfTouch_inView_ with a nil view, but none of None, ns(None), ObjCInstance(0) worked.

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

        None should work. What happens when you pass that? I have a suspicion that this might be related to 32/64-bit again...

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

          I just tried this on a first-gen iPad mini (32-bit), and it worked fine, so 32/64-bit is probably not the issue here.

          To test it, I've put this code in the [MapView Example]'s long_press method:

          # ...
          
          def long_press(self, sender):
              touch_loc = self.recognizer.locationOfTouch_inView_(0, None)
              print touch_loc.x, touch_loc.y
              # ...
          

          Perhaps you're passing something invalid for the touch parameter? Note that not all gesture recognizers actually track multiple touches; the maximum value should be recognizer.numberOfTouches() - 1, where numberOfTouches() returns the number of touches that actually participate in the gesture (while there might be other touches on the screen).

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