首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Finder URL解释

Finder URL解释
EN

Stack Overflow用户
提问于 2017-02-27 10:30:55
回答 1查看 68关注 0票数 0

在这个例程- tableView validateDrop中,我需要理解返回的项。退货项目数组似乎是文件ids?

代码语言:javascript
复制
func tableView(tableView: NSTableView, validateDrop info: NSDraggingInfo, 
proposedRow row: Int, proposedDropOperation dropOperation: NSTableViewDropOperation) -> NSDragOperation {
    print("validate drop \(dropOperation)")
    if dropOperation == .Above {
        //get the file URLs from the pasteboard
        let pasteboard = info.draggingPasteboard()

        //list the file type UTIs we want to accept
        let options = [NSPasteboardURLReadingFileURLsOnlyKey : true,
                       NSPasteboardURLReadingContentsConformToTypesKey : [kUTTypeMovie as String]]
        let items = pasteboard.readObjectsForClasses([NSURL.classForCoder()],
                                                         options: options)
        if items!.count > 0 {
            for item in items! {
                print("item -> \(item)")
            }

            print("validate Above -> .Copy")
            return .Copy;

        } else {

            print("validate Above -> .Move")
            return .Move

        }
    }
    print("validate other -> .None")
    return .None
}

以下哪项输出:

代码语言:javascript
复制
item -> file:///.file/id=6571367.34508463

在某种程度上,我需要将其转换为我可以使用的内容-一个典型的file://格式化的URL。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2017-02-27 21:53:21

废话

代码语言:javascript
复制
po item.filePathURL
▿ Optional<NSURL>
  - Some : file:///Users/slashlos/Movies/Flight%20to%20Mars.m4v

我可能不会转义以供用户查看

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/42476905

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档