#if USE_UIKIT_PUBLIC_HEADERS || !__has_include(<UIKitCore/UIDocumentInteractionController.h>)
//
// UIDocumentInteractionController.h
// UIKit
//
// Copyright (c) 2009-2018 Apple Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIActivityViewController.h>
#import <UIKit/UIKitDefines.h>
#import <UIKit/UIViewController.h>
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 <UIActionSheetDelegate>
#pragma mark |實例化|
+ (UIDocumentInteractionController *)interactionControllerWithURL:(NSURL *)url;
/// 代理(默認:nil)
@property(nullable, nonatomic, weak) id<UIDocumentInteractionControllerDelegate> delegate;
/// 文件URL路徑(如果設(shè)置,將更新文件的類型/圖標/名稱;默認:nil)
@property(nullable, strong) NSURL *URL;
/// 文件類型(如果設(shè)置則根據(jù)文件名確定URL路徑)
@property(nullable, nonatomic, copy) NSString *UTI;
/// 文件名(根據(jù)URL確定;如果URL使用自定義路徑,則覆蓋,并且無法自動確定名稱)
@property(nullable, copy) NSString *name;
/// 文件關(guān)聯(lián)的圖片(如果設(shè)置,則從名稱確定,否則為URL路徑;如果無法確定圖標,將返回通用文檔圖標;返回從最小到最大排序的圖標數(shù)組)
@property(nonatomic, readonly) NSArray<UIImage *> *icons;
/// 文件的自定義屬性(App傳遞給接收器的附加plist信息,必須是plist對象;默認:nil)
@property(nullable, nonatomic, strong) id annotation;
/**
文檔選項菜單設(shè)置(添加到指定視圖中)
@param rect 尺寸
@param view 指定父View
@param animated 是否開啟動畫
@return 是否已經(jīng)顯示選項菜單(菜單中沒有選項且未打開,返回NO)
- 允許用戶快速 查看/打開/復制 指定的文件
- 必須實現(xiàn) - documentInteractionControllerViewControllerForPreview: 方法以獲取“快速查看”菜單項
*/
- (BOOL)presentOptionsMenuFromRect:(CGRect)rect inView:(UIView *)view animated:(BOOL)animated;
/**
文檔選項菜單設(shè)置(添加到指定導航按鈕中)
@param item 指定導航按鈕
@param animated 是否開啟動畫
@return 是否已經(jīng)顯示選項菜單
*/
- (BOOL)presentOptionsMenuFromBarButtonItem:(UIBarButtonItem *)item animated:(BOOL)animated;
// 全屏預覽顯示文檔(模態(tài)方式彈出,需要實現(xiàn) - documentInteractionControllerViewControllerForPreview: 方法)
- (BOOL)presentPreviewAnimated:(BOOL)animated;
// 文檔"打開"菜單設(shè)置(類似于 - presentOptionsMenuFromRect:inView:animated: 方法)
- (BOOL)presentOpenInMenuFromRect:(CGRect)rect inView:(UIView *)view animated:(BOOL)animated;
// 文檔"打開"菜單設(shè)置(類似于 - presentOptionsMenuFromRect:inView:animated: 方法)
- (BOOL)presentOpenInMenuFromBarButtonItem:(UIBarButtonItem *)item animated:(BOOL)animated;
// 關(guān)閉快速查看
- (void)dismissPreviewAnimated:(BOOL)animated;
// 關(guān)閉菜單
- (void)dismissMenuAnimated:(BOOL)animated;
/// 設(shè)置文檔操作的手勢(如:點擊手勢啟動文檔的預覽,長按手勢顯示文檔的選項菜單)
@property(nonatomic, readonly) NSArray<__kindof UIGestureRecognizer *> *gestureRecognizers;
@end
///!!!: 代理 <協(xié)議>
/*
概述
- 響應(yīng)文檔交互控制器消息的一組方法
*/
__TVOS_PROHIBITED @protocol UIDocumentInteractionControllerDelegate <NSObject>
@optional
// 將要顯示文檔預覽
- (UIViewController *)documentInteractionControllerViewControllerForPreview:(UIDocumentInteractionController *)controller;
// 設(shè)置文檔預覽的起點坐標
- (CGRect)documentInteractionControllerRectForPreview:(UIDocumentInteractionController *)controller;
// 設(shè)置文檔預覽的承載視圖
- (nullable UIView *)documentInteractionControllerViewForPreview:(UIDocumentInteractionController *)controller;
// 文檔預覽將要顯示時的回調(diào)
- (void)documentInteractionControllerWillBeginPreview:(UIDocumentInteractionController *)controller;
// 文檔預覽已經(jīng)隱藏時的回調(diào)
- (void)documentInteractionControllerDidEndPreview:(UIDocumentInteractionController *)controller;
// 文檔選項菜單將要顯示時的回調(diào)
- (void)documentInteractionControllerWillPresentOptionsMenu:(UIDocumentInteractionController *)controller;
// 文檔選項菜單已經(jīng)隱藏時的回調(diào)
- (void)documentInteractionControllerDidDismissOptionsMenu:(UIDocumentInteractionController *)controller;
// 文檔將要顯示"打開"菜單時的回調(diào)
- (void)documentInteractionControllerWillPresentOpenInMenu:(UIDocumentInteractionController *)controller;
// 文檔已經(jīng)隱藏"打開"菜單時的回調(diào)
- (void)documentInteractionControllerDidDismissOpenInMenu:(UIDocumentInteractionController *)controller;
// 將要 跳轉(zhuǎn)到指定App打開文檔
- (void)documentInteractionController:(UIDocumentInteractionController *)controller willBeginSendingToApplication:(nullable NSString *)application;
// 已經(jīng) 跳轉(zhuǎn)到指定App打開文檔
- (void)documentInteractionController:(UIDocumentInteractionController *)controller didEndSendingToApplication:(nullable NSString *)application;
#pragma mark |棄用|
// 應(yīng)使用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 <UIKitCore/UIDocumentInteractionController.h>
#endif
UIDocumentInteractionController.h
?著作權(quán)歸作者所有,轉(zhuǎn)載或內(nèi)容合作請聯(lián)系作者
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。
平臺聲明:文章內(nèi)容(如有圖片或視頻亦包括在內(nèi))由作者上傳并發(fā)布,文章內(nèi)容僅代表作者本人觀點,簡書系信息發(fā)布平臺,僅提供信息存儲服務(wù)。
推薦閱讀更多精彩內(nèi)容
- 前言 UIToolbar 第一次接觸是因為 導航控制器的 toolbarHidden 和 toolbar 屬性。 ...
- objc-runtime.h 中代碼: #include <objc/runtime.h> #include<ob...
- methodForSelector //返回指定方法實現(xiàn)的地址performSelector: withObje...