< UIKit >

UIDocumentBrowserAction.h

2019-06-21  本文已影响0人  zhYx_

#if USE_UIKIT_PUBLIC_HEADERS || !__has_include(<DocumentManager/UIDocumentBrowserAction.h>)
//
//  UIDocumentBrowserAction.h
//  UIKit
//
//  Copyright © 2017 Apple Inc. All rights reserved.
//

#import <Foundation/Foundation.h>

@class UIImage;

NS_ASSUME_NONNULL_BEGIN



/* 操作显示的位置 <枚举> */
typedef NS_OPTIONS(NSInteger, UIDocumentBrowserActionAvailability) {
    UIDocumentBrowserActionAvailabilityMenu = 1,                /// 菜单中显示
    UIDocumentBrowserActionAvailabilityNavigationBar = 1 << 1,  /// 导航栏显示
} API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos,watchos,tvos)  NS_SWIFT_NAME(UIDocumentBrowserAction.Availability);





#pragma mark - 文档浏览器操作 Class
#pragma mark -
/*
 概述
    - 此对象的实例是由UIDocumentBrowserViewController呈现给用户的自定义文档操作
    - 操作可显示在 文档处于选择状态下的导航栏 或 长按之后的菜单中
    - 系统提供默认标准操作:复制/移动/重命名/删除/共享
    - 要添加自定义操作,请将此对象的数组分配给浏览器的customActions属性
 */
API_AVAILABLE(ios(11.0)) API_UNAVAILABLE(macos,watchos,tvos)  @interface UIDocumentBrowserAction : NSObject

#pragma mark |实例化|
- (instancetype)init NS_UNAVAILABLE;
/**
 实例化

 @param identifier 标识符
 @param localizedTitle 在编辑菜单或导航栏中的标题(此标题应该是NSLocalizedString返回的字符串)
 @param availability 操作显示的位置
 @param handler 触发操作后的回调(URL属性:用户已选择的文档的URL数组;如果action的supportsMultipleItems属性为NO,则此数组包含一个URL,否则可能包含多个URL)
 @return UIDocumentBrowserAction
 */
- (instancetype)initWithIdentifier:(NSString *)identifier localizedTitle:(NSString *)localizedTitle availability:(UIDocumentBrowserActionAvailability)availability handler:(void(^)(NSArray <NSURL *> *))handler NS_DESIGNATED_INITIALIZER;

/// 标识符
@property (nonatomic, readonly) NSString *identifier;
/// 在编辑菜单或导航栏中的标题
@property (nonatomic, readonly) NSString *localizedTitle;
/// 操作显示的位置
@property (nonatomic, readonly) UIDocumentBrowserActionAvailability availability;
/// 显示在导航栏中的图片
@property (nonatomic, strong, nullable) UIImage *image;
/// 统一类型标识符(用于定义操作支持的文档类型;默认:kUTTypeItem)
@property (nonatomic, copy) NSArray<NSString*> *supportedContentTypes;
/// 是否允许同时在多个文档上触发操作(默认:YES)
@property (nonatomic, assign) BOOL supportsMultipleItems;

@end





NS_ASSUME_NONNULL_END

#else
#import <DocumentManager/UIDocumentBrowserAction.h>
#endif

上一篇下一篇

猜你喜欢

热点阅读