gpt4 book ai didi

ios - 这个属性声明是什么意思?

转载 作者:塔克拉玛干 更新时间:2023-11-02 07:55:53 25 4
gpt4 key购买 nike

所以我正在学习一些 Xcode,今天我正在学习一个在线教程,我偶然发现了使用属性 titleTextWithAttributes

我正在查看头文件,但无法阅读这段代码。直接从文件中。请注意,我不想了解如何使用它,而是想了解它是如何定义的。

/* You may specify the font, text color, and shadow properties for the title in the text attributes dictionary, using the keys found in NSAttributedString.h.
*/
@property(nullable,nonatomic,copy) NSDictionary<NSString *,id> *titleTextAttributes NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR;

非常感谢您的帮助:)

最佳答案

@property(nullable,nonatomic,copy) NSDictionary<NSString *,id> *titleTextAttributes NS_AVAILABLE_IOS(5_0) UI_APPEARANCE_SELECTOR;

@property(nullable,nonatomic,copy) :声明一个 property 。允许为 nil ( nullable )。它将具有与多线程有关的非原子语义——这意味着,默认情况下它在没有一些同步的情况下不是线程安全的(不用担心这一点),当它被设置时,它将生成 copy

NSDictionary<NSString *,id> * - 属性的类型是将字符串映射到任何对象 (id) 的字典。

titleTextAttributes - 属性的名称

NS_AVAILABLE_IOS(5_0) - 这是一个不对代码执行任何操作的宏,但让您知道它自 iOS 5.0 以来可用

UI_APPEARANCE_SELECTOR 的文档说:

To participate in the appearance proxy API, tag your appearance property selectors in your header with UI_APPEARANCE_SELECTOR.

Appearance property selectors must be of the form:

 - (void)setProperty:(PropertyType)property forAxis1:(IntegerType)axis1 axis2:(IntegerType)axis2 axisN:(IntegerType)axisN;
- (PropertyType)propertyForAxis1:(IntegerType)axis1 axis2:(IntegerType)axis2 axisN:(IntegerType)axisN;

You may have no axes or as many as you like for any property. PropertyType may be any standard iOS type: id, NSInteger, NSUInteger, CGFloat, CGPoint, CGSize, CGRect, UIEdgeInsets or UIOffset. IntegerType must be either NSInteger or NSUInteger; we will throw an exception if other types are used in the axes.

关于ios - 这个属性声明是什么意思?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38062816/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com