我可以通过 UIAppearance 代理设置哪些属性? [英] What properties can I set via an UIAppearance proxy?

查看:18
本文介绍了我可以通过 UIAppearance 代理设置哪些属性?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我可以通过 UIAppearance 代理设置哪些属性?Apple 的 UIKit 文档没有列出它们.有这些属性的列表吗?

What properties can I set via an UIAppearance proxy? Apple's UIKit documentation does not list them. Is there a list of these properties?

推荐答案

可以通过 UIAppearance 设置的属性在相应的头文件中用 UI_APPEARANCE_SELECTOR 标记.

Properties that can be set via UIAppearance are tagged with UI_APPEARANCE_SELECTOR in the corresponding header file.

要生成带有 UI_APPEARANCE_SELECTOR 标记的属性列表,您可以在终端中使用以下 unix 命令:

To generate a list of properties tagged with UI_APPEARANCE_SELECTOR, you can use the following unix commands in a terminal:

cd /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer‌​/SDKs/iPhoneOS5.1.sdk/System/Library/Frameworks/UIKit.framework/Headers
grep -H UI_APPEARANCE_SELECTOR ./* | sed 's/ __OSX_AVAILABLE_STARTING(__MAC_NA,__IPHONE_5_0) UI_APPEARANCE_SELECTOR;//'

这是我使用上述命令编译的列表.这是针对 5.0 SDK 的.为简洁起见,省略了相应的 getter 方法.

Here is a list that I compiled using the above commands. This is for the 5.0 SDK. The corresponding getter methods have been omitted for brevity.

UIActivityIndi​​catorView

@property (readwrite, nonatomic, retain) UIColor *color

UIBarButtonItem

@property(nonatomic,retain) UIColor *tintColor
- (void)setBackgroundImage:(UIImage *)backgroundImage forState:(UIControlState)state barMetrics:(UIBarMetrics)barMetrics
- (void)setBackgroundVerticalPositionAdjustment:(CGFloat)adjustment forBarMetrics:(UIBarMetrics)barMetrics 
- (void)setTitlePositionAdjustment:(UIOffset)adjustment forBarMetrics:(UIBarMetrics)barMetrics 
- (void)setBackButtonBackgroundImage:(UIImage *)backgroundImage forState:(UIControlState)state barMetrics:(UIBarMetrics)barMetrics
- (void)setBackButtonTitlePositionAdjustment:(UIOffset)adjustment forBarMetrics:(UIBarMetrics)barMetrics
- (void)setBackButtonBackgroundVerticalPositionAdjustment:(CGFloat)adjustment forBarMetrics:(UIBarMetrics)barMetrics 

[iOS 6.0]
- (void)setBackgroundImage:(UIImage *)backgroundImage forState:(UIControlState)state style:(UIBarButtonItemStyle)style barMetrics:(UIBarMetrics)barMetrics [iOS 6.0]

UIBarItem

- (void)setTitleTextAttributes:(NSDictionary *)attributes forState:(UIControlState)state

UINavigationBar

@property(nonatomic,retain) UIColor *tintColor
@property(nonatomic,copy) NSDictionary *titleTextAttributes
- (void)setBackgroundImage:(UIImage *)backgroundImage forBarMetrics:(UIBarMetrics)barMetrics
- (void)setTitleVerticalPositionAdjustment:(CGFloat)adjustment forBarMetrics:(UIBarMetrics)barMetrics

[iOS 6.0]
@property(nonatomic,retain) UIImage *shadowImage

[iOS 7.0]
@property(nonatomic,retain) UIColor *barTintColor 
- (void)setBackgroundImage:(UIImage *)backgroundImage forBarPosition:(UIBarPosition)barPosition barMetrics:(UIBarMetrics)barMetrics 
- (UIImage *)backgroundImageForBarPosition:(UIBarPosition)barPosition barMetrics:(UIBarMetrics)barMetrics 
@property(nonatomic,retain) UIImage *backIndicatorImage 
@property(nonatomic,retain) UIImage *backIndicatorTransitionMaskImage 

UIPageControl

[iOS 6.0]
@property(nonatomic,retain) UIColor *pageIndicatorTintColor
@property(nonatomic,retain) UIColor *currentPageIndicatorTintColor

UIProgressView

@property(nonatomic, retain) UIColor* progressTintColor    
@property(nonatomic, retain) UIColor* trackTintColor    
@property(nonatomic, retain) UIImage* progressImage
@property(nonatomic, retain) UIImage* trackImage

UIRefreshControl

[iOS 6.0]
@property (nonatomic, retain) UIColor *tintColor
@property (nonatomic, retain) NSAttributedString *attributedTitle

UISearchBar

@property(nonatomic,retain) UIImage *backgroundImage
@property(nonatomic,retain) UIImage *scopeBarBackgroundImage
@property(nonatomic) UIOffset searchFieldBackgroundPositionAdjustment
@property(nonatomic) UIOffset searchTextPositionAdjustment
- (void)setSearchFieldBackgroundImage:(UIImage *)backgroundImage forState:(UIControlState)state
- (void)setImage:(UIImage *)iconImage forSearchBarIcon:(UISearchBarIcon)icon state:(UIControlState)state
- (void)setScopeBarButtonBackgroundImage:(UIImage *)backgroundImage forState:(UIControlState)state 
- (void)setScopeBarButtonDividerImage:(UIImage *)dividerImage forLeftSegmentState:(UIControlState)leftState rightSegmentState:(UIControlState)rightState
- (void)setScopeBarButtonTitleTextAttributes:(NSDictionary *)attributes forState:(UIControlState)state
- (void)setPositionAdjustment:(UIOffset)adjustment forSearchBarIcon:(UISearchBarIcon)icon

[iOS 7.0]
@property(nonatomic,retain) UIColor *barTintColor 
- (void)setBackgroundImage:(UIImage *)backgroundImage forBarPosition:(UIBarPosition)barPosition barMetrics:(UIBarMetrics)barMetrics 
- (UIImage *)backgroundImageForBarPosition:(UIBarPosition)barPosition barMetrics:(UIBarMetrics)barMetrics 

UISegmentedControl

@property(nonatomic,retain) UIColor *tintColor UI_APPEARANCE_SELECTOR;
- (void)setBackgroundImage:(UIImage *)backgroundImage forState:(UIControlState)state barMetrics:(UIBarMetrics)barMetrics 
- (void)setDividerImage:(UIImage *)dividerImage forLeftSegmentState:(UIControlState)leftState rightSegmentState:(UIControlState)rightState barMetrics:(UIBarMetrics)barMetrics
- (void)setTitleTextAttributes:(NSDictionary *)attributes forState:(UIControlState)state
- (void)setContentPositionAdjustment:(UIOffset)adjustment forSegmentType:(UISegmentedControlSegment)leftCenterRightOrAlone barMetrics:(UIBarMetrics)barMetrics

UISlider

@property(nonatomic,retain) UIColor *minimumTrackTintColor
@property(nonatomic,retain) UIColor *maximumTrackTintColor
@property(nonatomic,retain) UIColor *thumbTintColor

UIStepper

[iOS 6.0]
@property(nonatomic,retain) UIColor *tintColor
- (void)setBackgroundImage:(UIImage*)image forState:(UIControlState)state
- (void)setDividerImage:(UIImage*)image forLeftSegmentState:(UIControlState)leftState rightSegmentState:(UIControlState)rightState
- (void)setIncrementImage:(UIImage *)image forState:(UIControlState)state
- (void)setDecrementImage:(UIImage *)image forState:(UIControlState)state

UISwitch

@property(nonatomic, retain) UIColor* onTintColor

[iOS 6.0]
@property(nonatomic, retain) UIColor *tintColor
@property(nonatomic, retain) UIColor *thumbTintColor
@property(nonatomic, retain) UIImage *onImage
@property(nonatomic, retain) UIImage *offImage

UITabBar

@property(nonatomic,retain) UIColor *tintColor
@property(nonatomic,retain) UIColor *selectedImageTintColor
@property(nonatomic,retain) UIImage *backgroundImage
@property(nonatomic,retain) UIImage *selectionIndicatorImage

[iOS 6.0]
@property(nonatomic,retain) UIImage *shadowImage

[iOS 7.0]
@property(nonatomic,retain) UIColor *barTintColor 
@property(nonatomic) UITabBarItemPositioning itemPositioning 
@property(nonatomic) CGFloat itemWidth 
@property(nonatomic) CGFloat itemSpacing 
@property(nonatomic) UIBarStyle barStyle 

UITabBarItem

- (void)setTitlePositionAdjustment:(UIOffset)adjustment

UITableView

[iOS 6.0]
@property(nonatomic, retain) UIColor *sectionIndexColor
@property(nonatomic, retain) UIColor *sectionIndexTrackingBackgroundColor

[iOS 7.0]
@property (nonatomic) UIEdgeInsets separatorInset 
@property(nonatomic, retain) UIColor *sectionIndexBackgroundColor 

UITableViewCell

[iOS 7.0]
@property (nonatomic) UIEdgeInsets separatorInset 

UITableViewHeaderFooterView

[iOS 6.0]
@property(nonatomic, retain) UIColor *tintColor

界面工具栏

@property(nonatomic,retain) UIColor *tintColor;
- (void)setBackgroundImage:(UIImage *)backgroundImage forToolbarPosition:(UIToolbarPosition)topOrBottom barMetrics:(UIBarMetrics)barMetrics

[iOS 6.0]
- (void)setShadowImage:(UIImage *)shadowImage forToolbarPosition:(UIToolbarPosition)topOrBottom

[iOS 7.0]
@property(nonatomic,retain) UIColor *barTintColor 

<小时>

(2012 年 7 月 3 日):此列表直到最新版本的 XCode (4.3.3) 才更改.


(July 3, 2012): This list hasn't changed up til the most recent version of XCode (4.3.3).

(2013 年 3 月 12 日):针对 SDK 6.1 更新了列表.适用于 iOS 6.0(或更高版本)的属性列在 [iOS 6.0] 标签下.

(March 12, 2013): List updated for SDK 6.1. Properties that apply for iOS 6.0 (or greater) are listed under the [iOS 6.0] tag.

(2013 年 10 月 24 日):针对 SDK 7.0 更新了列表.适用于 iOS 7.0(或更高版本)的属性列在 [iOS 7.0] 标签下.

(Oct. 24, 2013): List updated for SDK 7.0. Properties that apply for iOS 7.0 (or greater) are listed under the [iOS 7.0] tag.

这篇关于我可以通过 UIAppearance 代理设置哪些属性?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆