PSPDFMenuItem
Objective-C
@interface PSPDFMenuItem : UIMenuItem
Swift
class MenuItem : UIMenuItem
A block-based legacy menu item.
Warning
This class and the legacy menu system is deprecated. Use the modern menu system instead. Please see our Customizing Menus guide to learn more.
-
Deprecated
Deprecated in PSPDFKit 12.3 for iOS. Use the modern menu system instead.
Initialize
PSPDFMenuItem
with a block. Do not use this initializer unless your titles are unique when converted to lowercase and non-ASCII characters are stripped, because anidentifier
must be specified in that case. -
Deprecated
Deprecated in PSPDFKit 12.3 for iOS. Use the modern menu system instead.
Initialize
PSPDFMenuItem
with a block and an non-localized unique identifier for later manipulation. -
Deprecated
Deprecated in PSPDFKit 12.3 for iOS. Use the modern menu system instead.
Initialize
PSPDFMenuItem
with an image, a block and an non-localized unique identifier for later manipulation. Will not allow image colors.Declaration
Objective-C
- (nonnull instancetype)initWithTitle:(nonnull NSString *)title image:(nullable UIImage *)image block:(nonnull void (^)(void))block identifier:(nullable NSString *)identifier;
Swift
convenience init(title: String, image: UIImage?, block: @escaping () -> Void, identifier: String?)
-
Deprecated
Deprecated in PSPDFKit 12.3 for iOS. Use the modern menu system instead.
Initialize PSPDFMenuItem with an image, a block and an non-localized unique identifier for later manipulation.
Declaration
Objective-C
- (nonnull instancetype)initWithTitle:(nonnull NSString *)title image:(nullable UIImage *)image block:(nonnull void (^)(void))block identifier:(nullable NSString *)identifier allowImageColors:(BOOL)allowImageColors;
Swift
init(title: String, image: UIImage?, block: @escaping () -> Void, identifier: String?, allowImageColors: Bool)
-
Deprecated
Deprecated in PSPDFKit 12.3 for iOS. Use the modern menu system instead.
Menu item can be enabled/disabled. (disable simply hides it from the UIMenuController)
Declaration
Objective-C
@property (nonatomic, getter=isEnabled) BOOL enabled;
Swift
var isEnabled: Bool { get set }
-
Deprecated
Deprecated in PSPDFKit 12.3 for iOS. Use the modern menu system instead.
If this is set to YES, we will invoke the menu item automatically, instead of presenting it.
Declaration
Objective-C
@property (nonatomic) BOOL shouldInvokeAutomatically;
Swift
var shouldInvokeAutomatically: Bool { get set }
-
Deprecated
Deprecated in PSPDFKit 12.3 for iOS. Use the modern menu system instead.
Helper to identify the current action. Not localized.
Declaration
Objective-C
@property (nonatomic, copy, readonly, nullable) NSString *identifier;
Swift
var identifier: String? { get }
-
Deprecated
Deprecated in PSPDFKit 12.3 for iOS. Use the modern menu system instead.
Image of the menu item. 24x24px is a good size. Images larger than 32x32px are automatically resized.
If set the image will hide the title. This is prefixed to make sure it will work even when Apple decides to add support for images in future releases.
Warning
Due to implementation details, this will actually changetitle
. Useidentifier
to compare menu items instead. -
Deprecated
Deprecated in PSPDFKit 12.3 for iOS. Use the modern menu system instead.
Installs the menu handler. Needs to be called once per class. (A good place is the +load method)
Following methods will be swizzled:
- canBecomeFirstResponder
(if object doesn’t already return YES)- canPerformAction:withSender:
- methodSignatureForSelector:
- forwardInvocation:
The original implementation will be called if the
PSPDFMenuItem
selector is not detected.Declaration
Objective-C
+ (void)installMenuHandlerForObject:(nonnull id)object;
Swift
class func installMenuHandler(for object: Any)
Parameters
object
can be an instance or a class.
-
Deprecated
Deprecated in PSPDFKit 12.3 for iOS. Use the modern menu system instead.
Unavailable
Not the designated initializer
The parent designated initializer is not available in this subclass.
Declaration
Objective-C
- (nonnull instancetype)initWithTitle:(nonnull NSString *)title action:(nonnull SEL)action;
-
Deprecated
Deprecated in PSPDFKit 12.3 for iOS. Use the modern menu system instead.
Undocumented