PTToolGroupManager
@interface PTToolGroupManager : NSObject <NSCoding, PTOverridable>
The PTToolGroupManager class maintains a list of tool groups, represented
by instances of the PTToolGroup class, each of which contain a set of available
tools for that mode.
This class is designed to work in conjuction with the PTToolGroupToolbar class
to display the tool groups and provide interactive control over the current tool.
-
Initializes a newly created
PTToolGroupManagerinstance.Declaration
Objective-C
- (nonnull instancetype)init;Swift
init()Return Value
an initialized
PTToolGroupManagerinstance -
Returns an object initialized from data in a given unarchiver.
Declaration
Objective-C
- (nullable instancetype)initWithCoder:(nonnull NSCoder *)coder;Swift
init?(coder: NSCoder)Parameters
coderAn unarchiver object
Return Value
self, initialized using the data in decoder, ornilif the object could not be initialized -
Initializes a newly created
PTToolGroupManagerinstance with the provided tool manager.Declaration
Objective-C
- (nonnull instancetype)initWithToolManager: (nonnull PTToolManager *)toolManager;Swift
convenience init(toolManager: PTToolManager)Parameters
toolManagerThe tool manager to be used by the receiver
Return Value
an initialized
PTToolGroupManagerinstance -
The receiver uses this tool manager instance to manage the current tool and observes notifications posted by the tool manager.
Declaration
Objective-C
@property (nonatomic, strong, nullable) PTToolManager *toolManager;Swift
var toolManager: PTToolManager? { get set } -
The tool group manager’s delegate object.
Declaration
Objective-C
@property (nonatomic, weak, nullable) id<PTToolGroupManagerDelegate> delegate;Swift
weak var delegate: (any PTToolGroupManagerDelegate)? { get set } -
Whether this tool group manager is currently enabled. The receiver will not observe notifications posted by its
toolManagerwhen this property’s value isNO.The default value of this property is
NO.Declaration
Objective-C
@property (nonatomic, getter=isEnabled) BOOL enabled;Swift
var isEnabled: Bool { get set }
-
The list of tool groups managed by this tool group manager. Each tool group represents an “tool group”, each with their own set of available tools to be displayed.
Declaration
Objective-C
@property (nonatomic, copy) NSArray<PTToolGroup *> *_Nonnull groups;Swift
var groups: [PTToolGroup] { get set } -
Adds the specified
PTToolGroupinstances to the end of the list of tool groups ingroups. If the tool group is already ingroupsthen this method does nothing.Declaration
Objective-C
- (void)addToolGroup:(nonnull PTToolGroup *)toolGroup;Swift
func add(_ toolGroup: PTToolGroup)Parameters
toolGroupthe tool group to add
-
Inserts the given
PTToolGroupinstance at the specified index in the list of tool groups ingroups. If the tool group is already ingroupsthen this method does nothing.Declaration
Objective-C
- (void)insertToolGroup:(nonnull PTToolGroup *)toolGroup atIndex:(NSUInteger)index;Swift
func insert(_ toolGroup: PTToolGroup, at index: UInt)Parameters
toolGroupthe tool group to insert
indexthe index at which to insert the tool group in
groups -
Removes the specified
PTToolGroupinstances from the list of tool groups ingroups. If the tool group is not ingroupsthen this method does nothing.Declaration
Objective-C
- (void)removeToolGroup:(nonnull PTToolGroup *)toolGroup;Swift
func remove(_ toolGroup: PTToolGroup)Parameters
toolGroupthe tool group to remove
-
The currently selected tool group in
groups.When the
groupslist is empty, the value of this property isnil.Declaration
Objective-C
@property (nonatomic, strong, nullable) PTToolGroup *selectedGroup;Swift
var selectedGroup: PTToolGroup? { get set } -
The “View” tool group.
This group does not contain any tools.
Declaration
Objective-C
@property (nonatomic, strong, readonly) PTToolGroup *_Nonnull viewItemGroup;Swift
var viewItemGroup: PTToolGroup { get } -
The “Annotate” tool group.
Declaration
Objective-C
@property (nonatomic, strong, readonly) PTToolGroup *_Nonnull annotateItemGroup;Swift
var annotateItemGroup: PTToolGroup { get } -
The “Draw” tool group.
Declaration
Objective-C
@property (nonatomic, strong, readonly) PTToolGroup *_Nonnull drawItemGroup;Swift
var drawItemGroup: PTToolGroup { get } -
The “Fill And Sign” tool group.
Declaration
Objective-C
@property (nonatomic, strong, readonly) PTToolGroup *_Nonnull fillAndSignItemGroup;Swift
var fillAndSignItemGroup: PTToolGroup { get } -
The “Prepare Form” tool group.
Declaration
Objective-C
@property (nonatomic, strong, readonly) PTToolGroup *_Nonnull prepareFormItemGroup;Swift
var prepareFormItemGroup: PTToolGroup { get } -
The “Insert” tool group.
Declaration
Objective-C
@property (nonatomic, strong, readonly) PTToolGroup *_Nonnull insertItemGroup;Swift
var insertItemGroup: PTToolGroup { get } -
The “Measure” tool group.
Declaration
Objective-C
@property (nonatomic, strong, readonly) PTToolGroup *_Nonnull measureItemGroup;Swift
var measureItemGroup: PTToolGroup { get } -
The “Pens” tool group.
Declaration
Objective-C
@property (nonatomic, strong, readonly) PTToolGroup *_Nonnull pensItemGroup;Swift
var pensItemGroup: PTToolGroup { get } -
The “Redact” tool group.
Declaration
Objective-C
@property (nonatomic, strong, readonly) PTToolGroup *_Nonnull redactItemGroup;Swift
var redactItemGroup: PTToolGroup { get } -
The “Favorites” tool group.
Declaration
Objective-C
@property (nonatomic, strong, readonly) PTToolGroup *_Nonnull favoritesItemGroup;Swift
var favoritesItemGroup: PTToolGroup { get }
-
Creates a new item for the specified
PTToolsubclass. The item is not part of any group and must be added to an existing or new group in order to be used.Declaration
Objective-C
- (nonnull UIBarButtonItem *)createItemForToolClass:(nonnull Class)toolClass;Swift
func createItem(forToolClass toolClass: AnyClass) -> UIBarButtonItemParameters
toolClassthe
PTToolsubclass to be associated with the created itemReturn Value
a new item for the specified
PTToolsubclass
-
The undo manager currently being tracked by the tool group manager.
When the
toolManager‘s tool is aPTCreateToolBasesubclass and returnsYESfromPTCreateToolBase.undoManagerEnabledthen this property will be equal totoolManager.tool.undoManager. Otherwise,toolManager.undoManagerwill be returned.Declaration
Objective-C
@property (nonatomic, weak, readonly, nullable) NSUndoManager *undoManager;Swift
weak var undoManager: UndoManager? { get } -
The undo button item. When activated, this item calls
-undo:.This bar button item’s
UIBarButtonItem.enabledproperty is automatically updated to reflect the current value ofundoManager.canUndo.Declaration
Objective-C
@property (nonatomic, strong, readonly) UIBarButtonItem *_Nonnull undoButtonItem;Swift
var undoButtonItem: UIBarButtonItem { get } -
This method calls
[undoManager undo]on the tool group manager’sundoManagerproperty.Declaration
Objective-C
- (void)undo:(nullable id)sender;Swift
func undo(_ sender: Any?) -
The redo button item. When activated, this item calls
-redo:.This bar button item’s
UIBarButtonItem.enabledproperty is automatically updated to reflect the current value ofundoManager.canRedo.Declaration
Objective-C
@property (nonatomic, strong, readonly) UIBarButtonItem *_Nonnull redoButtonItem;Swift
var redoButtonItem: UIBarButtonItem { get } -
This method calls
[undoManager redo]on the tool group manager’sundoManagerproperty.Declaration
Objective-C
- (void)redo:(nullable id)sender;Swift
func redo(_ sender: Any?) -
Updates the state of the
undoButtonItemandredoButtonItembar button items.Declaration
Objective-C
- (void)updateUndoRedoItems;Swift
func updateUndoRedoItems()
-
The “Add Tool” button item. This item is to be shown when the
favoritesItemGroupis selected - it is not part of the tool group because it should always appear at the end of thefavoritesItemGroup‘s list of items and is not reorderable.Declaration
Objective-C
@property (nonatomic, strong, readonly) UIBarButtonItem *_Nonnull addFavoriteToolButtonItem;Swift
var addFavoriteToolButtonItem: UIBarButtonItem { get } -
This method asks the tool group manager’s
delegateto edit thefavoritesItemGroupvia the-[PTToolGroupManagerDelegate toolGroupManager:editItemsForGroup:]delegate method.Declaration
Objective-C
- (void)addFavoriteTool:(nonnull id)sender;Swift
func addFavoriteTool(_ sender: Any)
-
Whether editing of groups from the user interface is enabled. When enabled, the
editGroupButtonItemitem is displayed at the end of all tool groups, except for thefavoritesItemGroup, in the user interface.If this property is set to
NOand editing is disabled, then theeditGroupButtonItemitem will not be displayed in the user interface.The default value of this property is
YES.Declaration
Objective-C
@property (nonatomic, assign, unsafe_unretained, readwrite, getter=isEditingEnabled) BOOL editingEnabled;Swift
var isEditingEnabled: Bool { get set } -
The “Edit Items” button item. This item is to be shown at the end of all tool item groups, except for the
favoritesItemGroup, when theeditingEnabledproperty is set toYES.Declaration
Objective-C
@property (nonatomic, strong, readonly) UIBarButtonItem *_Nonnull editGroupButtonItem;Swift
var editGroupButtonItem: UIBarButtonItem { get } -
This method asks the tool group manager’s
delegateto edit the currently selected tool group in theselectedGroupproperty via the-[PTToolGroupManagerDelegate toolGroupManager:editItemsForGroup:]delegate method.If the
selectedGroupproperty isnilthen this method does nothing.Declaration
Objective-C
- (void)editSelectedGroup:(nonnull id)sender;Swift
func editSelectedGroup(_ sender: Any)
-
The “Apply redact” button item. This item is to be shown at the first of redact tool group.
Declaration
Objective-C
@property (nonatomic, strong, readonly) UIBarButtonItem *_Nonnull applyRedactButtonItem;Swift
var applyRedactButtonItem: UIBarButtonItem { get }
-
The “Add pages” button item. This item is to be shown at the last of insert tool group.
Declaration
Objective-C
@property (nonatomic, strong, readonly) UIBarButtonItem *_Nonnull addPagesButtonItem;Swift
var addPagesButtonItem: UIBarButtonItem { get }
-
The annotation style presets group for the
toolManager‘s current tool. This property is updated when the tool manager’s tool changes and depends on thePTTool.identifierproperty of the tool. Tools that appear in more than one tool group ingroupswill have different identifiers and different annotation style presets groups.Declaration
Objective-C
@property (nonatomic, strong, readonly, nullable) PTAnnotationStylePresetsGroup *annotStylePresets;Swift
var annotStylePresets: PTAnnotationStylePresetsGroup? { get }
-
Save the current set of tool groups in
groupsand the selected group to disk at the location specified by thePTToolGroupManager.savedGroupsURLclass property.Declaration
Objective-C
- (void)saveGroups;Swift
func saveGroups() -
Save the current set of tool groups in
groupsand the selected group to disk at the specified location.Declaration
Objective-C
- (void)saveGroupsToURL:(nonnull NSURL *)savedGroupsURL;Swift
func saveGroups(to savedGroupsURL: URL)Parameters
savedGroupsURLThe URL of the location at which to save the groups
-
Restore the set of tool groups and selected group from disk at the location specified by the
PTToolGroupManager.savedGroupsURLclass property.Declaration
Objective-C
- (void)restoreGroups;Swift
func restoreGroups() -
Restore the set of tool groups and selected group from disk at the specified location.
Declaration
Objective-C
- (void)restoreGroupsFromURL:(nonnull NSURL *)savedGroupsURL;Swift
func restoreGroups(from savedGroupsURL: URL)Parameters
savedGroupsURLThe URL of the location from which to restore the groups
-
The URL of the location at which to save and restore the set of tool groups and selected group.
The default value of this property is the URL of a
.plistfile inside the directory returned byPTToolsUtil.toolsResourcesDirectoryURL.Declaration
Objective-C
@property (class, nonatomic, strong, readonly) NSURL *_Nonnull savedGroupsURL;Swift
class var savedGroupsURL: URL { get }
PTToolGroupManager Class Reference