iOS UIKit框架学习—UIToolbar 发表于 2017-01-25 | 分类于 iOS | | 阅读次数: UIToolbar是显示一个或多个按钮的控件又称工具栏项。工具栏轻按时突出显示或不更改项目的外观。 12345678910111213141516171819202122232425262728293031@class UIBarButtonItem, UIColor;@protocol UIToolbarDelegate;NS_CLASS_AVAILABLE_IOS(2_0) __TVOS_PROHIBITED @interface UIToolbar : UIView <UIBarPositioning>// 工具栏外观样式@property(nonatomic) UIBarStyle barStyle UI_APPEARANCE_SELECTOR __TVOS_PROHIBITED; // default is UIBarStyleDefault (blue)// 工具栏上显示的选项@property(nullable, nonatomic, copy) NSArray<UIBarButtonItem *> *items;// 是否半透明显示@property(nonatomic,assign,getter=isTranslucent) BOOL translucent NS_AVAILABLE_IOS(3_0) UI_APPEARANCE_SELECTOR;// 工具栏上显示的选项,有动画效果- (void)setItems:(nullable NSArray<UIBarButtonItem *> *)items animated:(BOOL)animated;// 工具栏上按钮的底色@property(null_resettable, nonatomic, strong) UIColor *tintColor;// 工具栏的底色@property(nullable, nonatomic, strong) UIColor *barTintColor NS_AVAILABLE_IOS(7_0) UI_APPEARANCE_SELECTOR; // default is nil// 设置用于在给定位置和给定度量的背景的图像- (void)setBackgroundImage:(nullable UIImage *)backgroundImage forToolbarPosition:(UIBarPosition)topOrBottom barMetrics:(UIBarMetrics)barMetrics NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR;// 返回用于在给定位置和给定度量的背景的图像- (nullable UIImage *)backgroundImageForToolbarPosition:(UIBarPosition)topOrBottom barMetrics:(UIBarMetrics)barMetrics NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR;// 设置用于给定位置的工具栏阴影的图像- (void)setShadowImage:(nullable UIImage *)shadowImage forToolbarPosition:(UIBarPosition)topOrBottom NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR;// 返回用于给定位置的工具栏阴影的图像- (nullable UIImage *)shadowImageForToolbarPosition:(UIBarPosition)topOrBottom NS_AVAILABLE_IOS(6_0) UI_APPEARANCE_SELECTOR;// 代理@property(nullable, nonatomic, weak) id<UIToolbarDelegate> delegate NS_AVAILABLE_IOS(7_0); // You may not set the delegate when the toolbar is managed by a UINavigationController.@end__TVOS_PROHIBITED@protocol UIToolbarDelegate <UIBarPositioningDelegate>@end