UIActivityViewController句柄取消操作| Swift/Xcode
发布时间:2022-05-04 03:41:17 298
相关标签:
我无法在Swift中找到完整的代码,说明当用户按下;x";在UIActivityViewController(右上)中,取消共享。
这就是我目前拥有的:
do {
try pdfData.write(to: temporaryFileURL)
let vc = UIActivityViewController(activityItems: [temporaryFileURL], applicationActivities: [])
self.present(vc, animated: true, completion: nil)
} catch {
print(error)
}
我发现这个Objective-C代码可能有用。有人能帮我把它转换成Swift,并告诉我如何用我目前拥有的东西来实现它吗?
vc.completionWithItemsHandler = ^(NSString *activityType,
BOOL completed,
NSArray *returnedItems,
NSError *error){
// react to the completion
if (completed) {
// user shared an item
NSLog(@"We used activity type%@", activityType);
} else {
// user cancelled
NSLog(@"We didn't want to share anything after all.");
}
if (error) {
NSLog(@"An Error occured: %@, %@", error.localizedDescription, error.localizedFailureReason);
}
};
非常感谢。
特别声明:以上内容(图片及文字)均为互联网收集或者用户上传发布,本站仅提供信息存储服务!如有侵权或有涉及法律问题请联系我们。
举报