मुझे पता है कि नए UITableViewDropDelegate
और UITableViewDragDelegate
प्रतिनिधियों का उपयोग करते समय एक आइटम/सेल को फिर से व्यवस्थित करना संभव है, लेकिन क्या एकाधिक को संभालने में सहायता करना संभव है।क्या UITableView में एक समय में एकाधिक आइटम/कक्षों को पुन: क्रमबद्ध करने के लिए आईओएस 11 ड्रैग और ड्रॉप का उपयोग करना संभव है?
इस स्क्रीनशॉट में उदाहरण के लिए मेरे एक ही आइटम पकड़े हूँ:
और सेल छोड़ने जगह पर में कहते हैं।
हालांकि जब मैं कई कक्षों हड़पने मैं कोई प्रवेश संकेत मिलता है और कोशिकाओं पुन: व्यवस्थित करें अभ्यस्त:
अगर मैं किसी अन्य ऐप्स यह ठीक काम करता है से एक से अधिक आइटम, उदाहरण के iMessage से बाहर एक से अधिक संदेशों को खींच के लिए:
क्या यह केवल स्थानीय वस्तुओं के साथ तालिका दृश्य को पुन: व्यवस्थित करते समय ऐसा करना संभव है ताकि आप जल्दी से फिर से व्यवस्थित हो सकें?
UITableViewDragDelegate
extension DotViewController: UITableViewDragDelegate {
func tableView(_ tableView: UITableView, itemsForBeginning session: UIDragSession, at indexPath: IndexPath) -> [UIDragItem] {
return [getDragItem(forIndexPath: indexPath)]
}
func tableView(_ tableView: UITableView, itemsForAddingTo session: UIDragSession, at indexPath: IndexPath, point: CGPoint) -> [UIDragItem] {
return [getDragItem(forIndexPath: indexPath)]
}
func getDragItem(forIndexPath indexPath: IndexPath) -> UIDragItem {
// gets the item
}
}
UITableViewDropDelegate
extension DotViewController: UITableViewDropDelegate {
func tableView(_ tableView: UITableView, canHandle session: UIDropSession) -> Bool {
return true
}
func tableView(_ tableView: UITableView, dropSessionDidUpdate session: UIDropSession, withDestinationIndexPath destinationIndexPath: IndexPath?) -> UITableViewDropProposal {
return UITableViewDropProposal(operation: .move, intent: .insertAtDestinationIndexPath)
}
func tableView(_ tableView: UITableView, performDropWith coordinator: UITableViewDropCoordinator) {
// Handles Drop
}
}
viewDidLoad
override func viewDidLoad() {
super.viewDidLoad()
tableView.dataSource = self
tableView.delegate = self
tableView.dragDelegate = self
tableView.dropDelegate = self
tableView.dragInteractionEnabled = true
}
आप स्पष्ट कर सकते हैं कि कैसे बहु पंक्ति पुनर्व्यवस्था लागू किया जा सकता? क्या आप 'UITableViewDragDelegate' के बजाय निम्न-स्तरीय ड्रैग प्रतिनिधि विधियों को कार्यान्वित कर रहे हैं? –