210628 Mon
9498 ワード
学習内容
この3つを除いて、残りの読書は
このプロジェクトの実行に役立つドキュメント
Supporting Drag and Drop in Table Views Adopting Drag and Drop in a Table View DateFormatter tableView(_:editingStyleForRowAt:) Pickers UIDatePicker Git分岐戦略:Git FlowとGithub Flow
学習内容:Table ViewでDragとDropをサポート
Article
Supporting Drag and Drop in Table Views
Initiate drags and handle drops from a table view.
Overview
Table views support drag and drop through a specialized API that works with the rows being displayed.
[UITableViewDragDelegate](https://developer.apple.com/documentation/uikit/uitableviewdragdelegate)
protocol—and assign it to the [dragDelegate](https://developer.apple.com/documentation/uikit/uitableview/2897362-dragdelegate)
property of your table view. [UITableViewDropDelegate](https://developer.apple.com/documentation/uikit/uitableviewdropdelegate)
protocol—and assign it to the [dropDelegate](https://developer.apple.com/documentation/uikit/uitableview/2897372-dropdelegate)
property of your table view. Protocol
UITableViewDragDelegate
The interface for initiating drags from a table view.
Overview
Implement this protocol in the object that you use to initiate drags from your table view. The only required method of this protocol is the
[tableView(_:itemsForBeginning:at:)](https://developer.apple.com/documentation/uikit/uitableviewdragdelegate/2897492-tableview)
method, but you can implement other methods as needed to customize the drag behavior of your table view.Assign your custom delegate object to the
[dragDelegate](https://developer.apple.com/documentation/uikit/uitableview/2897362-dragdelegate)
property of your table view.Protocol
UITableViewDropDelegate
The interface for handling drops in a table view.
Overview
Implement this protocol in the object that you use to incorporate dropped data into your table view. The only required method of this protocol is the
[tableView(_:performDropWith:)](https://developer.apple.com/documentation/uikit/uitableviewdropdelegate/2897427-tableview)
method, but you can implement other methods as needed to customize the drop behavior of your table view.Assign your custom delegate object to the
[dropDelegate](https://developer.apple.com/documentation/uikit/uitableview/2897372-dropdelegate)
property of your table view.Class
NSItemProvider
An item provider for conveying data or a file between processes during drag and drop or copy/paste activities, or from a host app to an app extension.
class NSItemProvider : NSObject
OverviewStarting in iOS 11, item providers play a central role in drag and drop, and in copy/paste. They continue to play a role with app extensions.
All completion blocks used in the
NSItemProvider
class are called by the system on an internal queue. When using an item provider with drag and drop, ensure that user-interface updates take place on the main queue as follows:DispatchQueue.main.async {
// work that impacts the user interface
}
ClassUITableViewDropProposal
Your proposed solution for handling a drop in a table view.
Overview
Create instances of this class in the
[tableView(_:dropSessionDidUpdate:withDestinationIndexPath:)](https://developer.apple.com/documentation/uikit/uitableviewdropdelegate/2897302-tableview)
method of your drop delegate object. You create drop proposals to let the table view know how you intend to handle a drop at the currently specified location. The table view uses that information to provide appropriate visual feedback to the user.Enumeration
UITableViewDropProposal.Intent
Constants indicating how you intend to handle a drop.
[case unspecified](https://developer.apple.com/documentation/uikit/uitableviewdropproposal/intent/unspecified)
No drop proposal was specified.[case insertAtDestinationIndexPath](https://developer.apple.com/documentation/uikit/uitableviewdropproposal/intent/insertatdestinationindexpath)
Insert the dropped content at the specified index path. [case insertIntoDestinationIndexPath](https://developer.apple.com/documentation/uikit/uitableviewdropproposal/intent/insertintodestinationindexpath)
Incorporate the dropped content into the row at the specified index path. ⭐️この機能を使用すると、移動する写真の位置に対応するセルがグレーで強調表示されます.
ではプレイヤーの立場から見ると、私が今ここでdropしていたら、この位置に挿入されていたのでしょうね~!
[case automatic](https://developer.apple.com/documentation/uikit/uitableviewdropproposal/intent/automatic)
Incorporate the content in an appropriate way based on the drop location. ⭐️→これを書くと自分で
[insertAtDestinationIndexPath](https://developer.apple.com/documentation/uikit/uitableviewdropproposal/intent/insertatdestinationindexpath)
と書くか[insertIntoDestinationIndexPath](https://developer.apple.com/documentation/uikit/uitableviewdropproposal/intent/insertintodestinationindexpath)
と書くか決めるか?!Point1. IndexPath? 傍観者なのは、プレイヤーが落下点をセルのない場所に置くとnil値があるからです!
Point2.
When the user drags over the end of an existing section in the collection or table view. This index path might be equal to the count of the number of items in that section, which means it may not correspond to an existing item in that section. So be careful because that's an insert at the very end of the section.
placeholders
Temporary items or rows that you insert into your collection or table view. And the key thing about them is that you can defer updating your data source until the data finishes loading when you insert placeholders.
遅らせる
The way this works is that collection and table view will never actually call out to ask your delegate or data source about placeholders, so your delegates can remain blissfully unaware that they even exist.
Drag and Drop with Collection and Table View - WWDC17 - Videos - Apple Developer
Drag and Drop Tutorial for iOS
Reference
この問題について(210628 Mon), 我々は、より多くの情報をここで見つけました https://velog.io/@sunnywhynot/210628-Monテキストは自由に共有またはコピーできます。ただし、このドキュメントのURLは参考URLとして残しておいてください。
Collection and Share based on the CC Protocol