UIDocumentPickerViewController.h
2019-06-22 本文已影响0人
zhYx_
#if USE_UIKIT_PUBLIC_HEADERS || !__has_include(<UIKitCore/UIDocumentPickerViewController.h>)
//
// UIDocumentPickerViewController.h
// UIKit
//
// Copyright (c) 2014-2018 Apple Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIViewController.h>
NS_ASSUME_NONNULL_BEGIN
@class UIDocumentPickerViewController, UIDocumentMenuViewController;
///!!!: 代理 <协议>
__TVOS_PROHIBITED @protocol UIDocumentPickerDelegate <NSObject>
@optional
// 已经选择一个或多个文档时的回调
- (void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentsAtURLs:(NSArray <NSURL *>*)urls NS_AVAILABLE_IOS(11_0);
// 取消文档选择器时的回调(点击文档选择器的取消按钮)
- (void)documentPickerWasCancelled:(UIDocumentPickerViewController *)controller;
// 废弃(请使用 - documentPicker:didPickDocumentsAtURLs: 方法)
- (void)documentPicker:(UIDocumentPickerViewController *)controller didPickDocumentAtURL:(NSURL *)url NS_DEPRECATED_IOS(8_0, 11_0, "Implement documentPicker:didPickDocumentsAtURLs: instead");
@end
/* 选择器模式 <枚举> */
typedef NS_ENUM(NSUInteger, UIDocumentPickerMode) {
UIDocumentPickerModeImport, /// 导入沙箱外部文件
UIDocumentPickerModeOpen, /// 打开沙盒外部文件
UIDocumentPickerModeExportToService, /// 导出文件到沙盒外部
UIDocumentPickerModeMoveToService /// 移动文件到沙盒外部(并将其作为外部文件进行访问)
} NS_ENUM_AVAILABLE_IOS(8_0) __TVOS_PROHIBITED;
#pragma mark - 文档选择器控制器 Class
#pragma mark
/*
概述
- 可以访问App沙箱外的文档或目标
- 可以实现文档的 导入/导出/打开/移动
*/
NS_CLASS_AVAILABLE_IOS(8_0) __TVOS_PROHIBITED @interface UIDocumentPickerViewController : UIViewController
#pragma mark |实例化|
/* 有效模式为导入和打开 */
// 指定文档格式和选择器模式
- (instancetype)initWithDocumentTypes:(NSArray <NSString *>*)allowedUTIs inMode:(UIDocumentPickerMode)mode NS_DESIGNATED_INITIALIZER;
- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder NS_DESIGNATED_INITIALIZER;
/* 有效模式为导出和移动 */
// 指定文档URL路径和选择器模式(此方法将要废弃,请使用下边的方法)
- (instancetype)initWithURL:(NSURL *)url inMode:(UIDocumentPickerMode)mode NS_DESIGNATED_INITIALIZER;
- (instancetype)initWithURLs:(NSArray <NSURL *> *)urls inMode:(UIDocumentPickerMode)mode NS_DESIGNATED_INITIALIZER NS_AVAILABLE_IOS(11_0);
/// 代理
@property (nullable, nonatomic, weak) id<UIDocumentPickerDelegate> delegate;
/// 选择器模式
@property (nonatomic, assign, readonly) UIDocumentPickerMode documentPickerMode;
/// 是否可以同时选择多个文档
@property (nonatomic, assign) BOOL allowsMultipleSelection NS_AVAILABLE_IOS(11_0);
@end
NS_ASSUME_NONNULL_END
#else
#import <UIKitCore/UIDocumentPickerViewController.h>
#endif