1 简述
工具栏,用于管理窗口标题栏下方和应用程序的自定义内容上方的空间,以快速访问应用程序功能。
2 源码注解
@interface NSToolbar : NSObject
|
2.1 初始化创建
- (instancetype)initWithIdentifier:(NSToolbarIdentifier)identifier NS_DESIGNATED_INITIALIZER; - (instancetype)init API_AVAILABLE(macos(10.13));
|
2.2 代理
@property (nullable, weak) id<NSToolbarDelegate> delegate;
@protocol NSToolbarDelegate <NSObject>
@optional - (nullable NSToolbarItem *)toolbar:(NSToolbar *)toolbar itemForItemIdentifier:(NSToolbarItemIdentifier)itemIdentifier willBeInsertedIntoToolbar:(BOOL)flag;
- (NSArray<NSToolbarItemIdentifier> *)toolbarDefaultItemIdentifiers:(NSToolbar *)toolbar;
- (NSArray<NSToolbarItemIdentifier> *)toolbarAllowedItemIdentifiers:(NSToolbar *)toolbar;
@optional
- (NSArray<NSToolbarItemIdentifier> *)toolbarSelectableItemIdentifiers:(NSToolbar *)toolbar;
- (void)toolbarWillAddItem:(NSNotification *)notification;
- (void)toolbarDidRemoveItem:(NSNotification *)notification;
|
2.3 属性