• Thanks @cvp. Works a treat! That's exactly what I want.

    I wasn't aware of will_close but, of course, I found it now in the doco.

  • @mikael it works...it isn't feature-complete, and I was unable to figure out how to consistently get the proper animation of items when they are moved to a new location (it doesn't always animate the properties of the moved cell in the right way, or the cell in the new location is displayed before the move animation happens).

    Let me try to extricate the code which is unrelated to the implementation of the UICollectionView from the custom code for my specific purposes. Maybe someone can figure out why my end-move animation is wonky.

  • One final query....
    If I wanted to implement this, how would I change the class code?

    def make(bits=256): assert bits in (256, 512) hashes = [] for hsh in range(int(bits//256)): myhash = TouchHash() hashes.append(myhash) return "".join(hashes)
  • That's weird. I wrote and tested the script on my iPad. Did you run the exact script in the linked post? Should be the second script that doesn't crash.

    Here is the code, if you don't care to guess.


    # coding: utf-8 from objc_util import * import ctypes import ui SUIViewController = ObjCClass('SUIViewController') UIAlertController = ObjCClass('UIAlertController') UIAlertAction = ObjCClass('UIAlertAction') def ok_pressed(sender): print 'OK pressed', ObjCInstance(sender), dir(ObjCInstance(sender)) alert = UIAlertController.alertControllerWithTitle_message_preferredStyle_(ns('My Alert'), ns('My Message'), 0) alert_action_block = ObjCBlock(ok_pressed, None, [c_void_p]) default_action = UIAlertAction.actionWithTitle_style_handler_(ns('OK'), 0, alert_action_block) alert.addAction_(default_action) ##rvc.presentModalViewController_animated_(alert, True) ## Stop Crashes retain_global(alert_action_block) def button_tapped(sender): super_view = sender.superview super_view_pntr = ObjCInstance(super_view) vc = SUIViewController.viewControllerForView_(super_view_pntr) vc.presentModalViewController_animated_(alert, True) view = ui.View(frame=(0,0,500,500)) view.name = 'Demo' view.background_color = 'white' button = ui.Button(title='Tap me!') button.center = (view.width * 0.5, view.height * 0.5) button.flex = 'LRTB' button.action = button_tapped view.add_subview(button) view.present('sheet')
Internal error.

Oops! Looks like something went wrong!