ios - UITableViewCell won't move beyond it's row when in drag and drop edit mode -
i'm following this official documentation apple. i'm trying implement drag , drop functionality on uitableview
. problem is, rows won't move pass rows. can see, bounce back:
here code:
func tableview(tableview: uitableview, moverowatindexpath sourceindexpath: nsindexpath, toindexpath destinationindexpath: nsindexpath) { // gets called, when reach uitableviewcell above or below // 1 uitableviewcell i'm dragging around. part // snaps think. } func tableview(tableview: uitableview, targetindexpathformovefromrowatindexpath sourceindexpath: nsindexpath, toproposedindexpath proposeddestinationindexpath: nsindexpath) -> nsindexpath { return proposeddestinationindexpath }
i'm using dznemptydataset library , not quite sure, if meddles original functionality of uitableview
.
what missing here?
edit: have created new viewcontroller
tableview
in project , behaves same. if try implement functionality in new project however, works intended.
the 'problem' library mmdrawercontroller. when enabling editing on tableview
have disable mmdrawercontroller
gestures. here code fixed problem:
/// /// enable edit mode /// func editentries() { self.disabledrawerfunctionality() self.tableview.setediting(true, animated: true) self.navigationitem.rightbarbuttonitem = uibarbuttonitem(title: "fertig", style: .plain, target: self, action: "finishedediting:") } func finishedediting(sender: anyobject) { self.tableview.setediting(false, animated: true) self.navigationitem.rightbarbuttonitem = self.barbuttonitemedit self.enabledrawerfunctionality() } // mark: - toggle drawer functionalities /// /// while in tableview edit mode: sure disable mmdrawer gestures, since gestures colide /// gestures of tableview /// func enabledrawerfunctionality() { mm_drawercontroller.opendrawergesturemodemask = .panningcenterview mm_drawercontroller.closedrawergesturemodemask = .panningdrawerview | .panningcenterview } /// /// when leaving tableview edit mode: re-enable mmdrawer gestures after finishing editting tableview /// func disabledrawerfunctionality() { mm_drawercontroller.opendrawergesturemodemask = .none mm_drawercontroller.closedrawergesturemodemask = .none }
here part of readme caught attention:
you free set whatever combination want opening , closing. note these gestures may impact touches sent child view controllers, sure use these appropriately application. example, wouldn't want mmopendrawergesturemodepanningcenterview set if mkmapview center view controller, since intercept pan meant moving around map.
Comments
Post a Comment