NSDictionary(GCKAdditions) 类别参考
概览
一个类别,向 NSDictionary 添加了一些便捷方法,用于安全地查找各种类型的值。
这些方法对于获取和设置 JSON 数据对象的字段特别有用。
实例方法摘要 | |
(nullable NSString *) | - gck_stringForKey:withDefaultValue: |
查找具有指定后备值的键的 NSString 值。更多... | |
(nullable NSString *) | - gck_stringForKey: |
查找回退值为 nil 的键的 NSString 值。更多... | |
(NSInteger) | - gck_integerForKey:withDefaultValue: |
查找具有指定后备值的键的 NSInteger 值。更多... | |
(NSUInteger) | - gck_uintegerForKey:withDefaultValue: |
查找具有指定后备值的键的 NSUInteger 值。更多... | |
(NSInteger) | - gck_integerForKey: |
查找回退值为 0 的键的 NSInteger 值。更多... | |
(NSUInteger) | - gck_uintegerForKey: |
查找回退值为 0 的键的 NSUInteger 值。更多... | |
(double) | - gck_doubleForKey:withDefaultValue: |
查找具有指定后备值的键的 double 值。更多... | |
(double) | - gck_doubleForKey: |
查找回退值为 0.0 的键的 double 值。更多... | |
(BOOL) | - gck_boolForKey:withDefaultValue: |
查找具有指定后备值的键的 BOOL 值。更多... | |
(BOOL) | - gck_boolForKey: |
查找回退值为 NO 的键的 BOOL 值。更多... | |
(nullable NSDictionary *) | - gck_dictionaryForKey: |
查找回退值为 nil 的 NSDictionary 值。更多... | |
(nullable NSArray *) | - gck_arrayForKey: |
查找回退值为 nil 的键的 NSArray 值。更多... | |
(nullable NSURL *) | - gck_urlForKey: |
查找回退值为 nil 的键的 NSURL 值。更多... | |
方法详细信息
- (nullable NSString *) gck_stringForKey: | (NSString *) | key | |
withDefaultValue: | (nullable NSString *) | defaultValue | |
- (nullable NSString *) gck_stringForKey: | (NSString *) | key |
- (NSInteger) gck_integerForKey: | (NSString *) | key | |
withDefaultValue: | (NSInteger) | defaultValue | |
- (NSUInteger) gck_uintegerForKey: | (NSString *) | key | |
withDefaultValue: | (NSUInteger) | defaultValue | |
查找具有指定后备值的键的 NSUInteger 值。
- Parameters
-
key The key. defaultValue The default value to return if the key is not found or if its value is not an NSNumber.
- 返回
- 如果找到了键的值,则为 NSNumber;否则为默认值。
- (NSInteger) gck_integerForKey: | (NSString *) | key |
- (NSUInteger) gck_uintegerForKey: | (NSString *) | key |
- (double) gck_doubleForKey: | (NSString *) | key | |
withDefaultValue: | (double) | defaultValue | |
- (double) gck_doubleForKey: | (NSString *) | key |
- (BOOL) gck_boolForKey: | (NSString *) | key | |
withDefaultValue: | (BOOL) | defaultValue | |
- (BOOL) gck_boolForKey: | (NSString *) | key |
- (nullable NSDictionary *) gck_dictionaryForKey: | (NSString *) | key |
- (nullable NSArray *) gck_arrayForKey: | (NSString *) | key |