我正在创建一个静态库。
在此,我想声明与Apple的UITextAttributeFont
声明相似的键。
UIKIT_EXTERN NSString *const UITextAttributeFont NS_DEPRECATED_IOS(5_0, 7_0, "Use NSFontAttributeName");
// Key to the text color in the text attributes dictionary. A UIColor instance is expected.
UIKIT_EXTERN NSString *const UITextAttributeTextColor NS_DEPRECATED_IOS(5_0, 7_0, "Use NSForegroundColorAttributeName");
// Key to the text shadow color in the text attributes dictionary. A UIColor instance is expected.
UIKIT_EXTERN NSString *const UITextAttributeTextShadowColor NS_DEPRECATED_IOS(5_0, 7_0, "Use NSShadowAttributeName with an NSShadow instance as the value");
// Key to the offset used for the text shadow in the text attributes dictionary. An NSValue instance wrapping a UIOffset struct is expected.
UIKIT_EXTERN NSString *const UITextAttributeTextShadowOffset NS_DEPRECATED_IOS(5_0, 7_0, "Use NSShadowAttributeName with an NSShadow instance as the value");
在我的一种方法中,我期待来自最终开发者的NSDictionary
。
此dictionary
应包含我所描述的密钥的值。
我尝试使用它,但在应用程序中它抛出一个错误,表示该常量尚未声明。
我的宣言:
/*In header file */
extern NSString *const event1;
extern NSString *const event2;
我正在为文件的.m内的这些常量赋值。
NSString *const event1 = @"My_Event";
NSString *const event2 = @"My_Second_Event";
如何允许用户使用字典中的键作为指定的常量值?