UIDocumentInteractionController.h


#if USE_UIKIT_PUBLIC_HEADERS || !__has_include()
//
//  UIDocumentInteractionController.h
//  UIKit
//
//  Copyright (c) 2009-2018 Apple Inc. All rights reserved.
//

#import 
#import 
#import 
#import 

NS_ASSUME_NONNULL_BEGIN

@protocol UIDocumentInteractionControllerDelegate;
@class UIImage, UIView, UIPopoverController;





#pragma mark - 文档交互控制器 Class
#pragma mark -
NS_CLASS_AVAILABLE_IOS(3_2) __TVOS_PROHIBITED @interface UIDocumentInteractionController : NSObject 

#pragma mark |实例化|
+ (UIDocumentInteractionController *)interactionControllerWithURL:(NSURL *)url;

/// 代理(默认:nil)
@property(nullable, nonatomic, weak) id delegate;
/// 文件URL路径(如果设置,将更新文件的类型/图标/名称;默认:nil)
@property(nullable, strong)             NSURL    *URL;
/// 文件类型(如果设置则根据文件名确定URL路径)
@property(nullable, nonatomic, copy)    NSString *UTI;
/// 文件名(根据URL确定;如果URL使用自定义路径,则覆盖,并且无法自动确定名称)
@property(nullable, copy)               NSString *name;
/// 文件关联的图片(如果设置,则从名称确定,否则为URL路径;如果无法确定图标,将返回通用文档图标;返回从最小到最大排序的图标数组)
@property(nonatomic, readonly)          NSArray  *icons;
/// 文件的自定义属性(App传递给接收器的附加plist信息,必须是plist对象;默认:nil)
@property(nullable, nonatomic, strong)  id annotation;

/**
 文档选项菜单设置(添加到指定视图中)

 @param rect 尺寸
 @param view 指定父View
 @param animated 是否开启动画
 @return 是否已经显示选项菜单(菜单中没有选项且未打开,返回NO)
 
 - 允许用户快速 查看/打开/复制 指定的文件
 - 必须实现 - documentInteractionControllerViewControllerForPreview: 方法以获取“快速查看”菜单项
 */
- (BOOL)presentOptionsMenuFromRect:(CGRect)rect inView:(UIView *)view animated:(BOOL)animated;
/**
 文档选项菜单设置(添加到指定导航按钮中)

 @param item 指定导航按钮
 @param animated 是否开启动画
 @return 是否已经显示选项菜单
 */
- (BOOL)presentOptionsMenuFromBarButtonItem:(UIBarButtonItem *)item animated:(BOOL)animated;
// 全屏预览显示文档(模态方式弹出,需要实现 - documentInteractionControllerViewControllerForPreview: 方法)
- (BOOL)presentPreviewAnimated:(BOOL)animated;

// 文档"打开"菜单设置(类似于 - presentOptionsMenuFromRect:inView:animated: 方法)
- (BOOL)presentOpenInMenuFromRect:(CGRect)rect inView:(UIView *)view animated:(BOOL)animated;
// 文档"打开"菜单设置(类似于 - presentOptionsMenuFromRect:inView:animated: 方法)
- (BOOL)presentOpenInMenuFromBarButtonItem:(UIBarButtonItem *)item animated:(BOOL)animated;

// 关闭快速查看
- (void)dismissPreviewAnimated:(BOOL)animated;
// 关闭菜单
- (void)dismissMenuAnimated:(BOOL)animated;

/// 设置文档操作的手势(如:点击手势启动文档的预览,长按手势显示文档的选项菜单)
@property(nonatomic, readonly) NSArray<__kindof UIGestureRecognizer *> *gestureRecognizers;

@end





///!!!: 代理 <协议>
/*
 概述
  - 响应文档交互控制器消息的一组方法
 */
__TVOS_PROHIBITED @protocol UIDocumentInteractionControllerDelegate 

@optional
// 将要显示文档预览
- (UIViewController *)documentInteractionControllerViewControllerForPreview:(UIDocumentInteractionController *)controller;
// 设置文档预览的起点坐标
- (CGRect)documentInteractionControllerRectForPreview:(UIDocumentInteractionController *)controller;
// 设置文档预览的承载视图
- (nullable UIView *)documentInteractionControllerViewForPreview:(UIDocumentInteractionController *)controller;

// 文档预览将要显示时的回调
- (void)documentInteractionControllerWillBeginPreview:(UIDocumentInteractionController *)controller;
// 文档预览已经隐藏时的回调
- (void)documentInteractionControllerDidEndPreview:(UIDocumentInteractionController *)controller;

// 文档选项菜单将要显示时的回调
- (void)documentInteractionControllerWillPresentOptionsMenu:(UIDocumentInteractionController *)controller;
// 文档选项菜单已经隐藏时的回调
- (void)documentInteractionControllerDidDismissOptionsMenu:(UIDocumentInteractionController *)controller;

// 文档将要显示"打开"菜单时的回调
- (void)documentInteractionControllerWillPresentOpenInMenu:(UIDocumentInteractionController *)controller;
// 文档已经隐藏"打开"菜单时的回调
- (void)documentInteractionControllerDidDismissOpenInMenu:(UIDocumentInteractionController *)controller;

// 将要 跳转到指定App打开文档
- (void)documentInteractionController:(UIDocumentInteractionController *)controller willBeginSendingToApplication:(nullable NSString *)application;
// 已经 跳转到指定App打开文档
- (void)documentInteractionController:(UIDocumentInteractionController *)controller didEndSendingToApplication:(nullable NSString *)application;

#pragma mark |弃用|
// 应使用UIActivityViewController进行操作
- (BOOL)documentInteractionController:(UIDocumentInteractionController *)controller canPerformAction:(nullable SEL)action NS_DEPRECATED_IOS(3_2, 6_0);
- (BOOL)documentInteractionController:(UIDocumentInteractionController *)controller performAction:(nullable SEL)action NS_DEPRECATED_IOS(3_2, 6_0);

@end 





NS_ASSUME_NONNULL_END

#else
#import 
#endif

你可能感兴趣的:(UIDocumentInteractionController.h)