#if USE_UIKIT_PUBLIC_HEADERS || !__has_include(<UIKitCore/UIBarButtonItemGroup.h>)
//
// UIBarButtonItemGroup.h
// UIKit
//
// Copyright (c) 2014-2018 Apple Inc. All rights reserved.
//
#import <Foundation/Foundation.h>
#import <UIKit/UIBarButtonItem.h>
NS_ASSUME_NONNULL_BEGIN
#pragma mark - 标签按钮组
#pragma mark -
NS_CLASS_AVAILABLE_IOS(9_0) @interface UIBarButtonItemGroup : NSObject<NSCoding>
/* 实例化 */
/**
实例化
@param barButtonItems 一组标签按钮
@param representativeItem 折叠标识项(为一组按钮设置标签,按钮折叠时用)
@return UIBarButtonItemGroup
*/
- (instancetype)initWithBarButtonItems:(NSArray<UIBarButtonItem *> *)barButtonItems representativeItem:(nullable UIBarButtonItem *)representativeItem NS_DESIGNATED_INITIALIZER;
- (nullable instancetype)initWithCoder:(NSCoder *)aDecoder NS_DESIGNATED_INITIALIZER;
// 设置 一组标签按钮(可直接修改/操作数组中的某个按钮)
@property (nonatomic, readwrite, copy) NSArray<UIBarButtonItem *> *barButtonItems;
// 设置 折叠标识项
@property (nonatomic, readwrite, strong, nullable) UIBarButtonItem *representativeItem;
// 获取 是否正在显示该组(通过representativeItem标识区分组)
@property (nonatomic, readonly, assign, getter = isDisplayingRepresentativeItem) BOOL displayingRepresentativeItem;
@end
#pragma mark - 标签按钮组 (UIBarButtonItem 分类)
#pragma mark -
@interface UIBarButtonItem (UIBarButtonItemGroup)
// 获取 UIBarButtonItem当前与之关联的组(可以是barButtonItems数组的成员,也可以是该组的representativeItem)
@property (nonatomic, readonly, weak, nullable) UIBarButtonItemGroup *buttonGroup NS_AVAILABLE_IOS(9_0);
@end
NS_ASSUME_NONNULL_END
#else
#import <UIKitCore/UIBarButtonItemGroup.h>
#endif
网友评论