(NSDictionary *) labelAttrs = 0x00000001

While doing some debugging, I printed out the description of the NSDictionary variable, which gives the following:

(NSDictionary *) labelAttrs = 0x00000001

Can someone clarify why this is 1?

I would understand nilor an object pointer, but why 1?

UPDATE

The code:

NSDictionary *labelAttrs = @{NSForegroundColorAttributeName:[UIColor darkGrayColor]};

Crash on launch on iOS5, but not iOS6, but this:

Are new object literals backward compatible with iOS 5?

it looks like you can use new literals with iOS5 (as long as you create against iOS6 and use Xcode> = 4.5 and compile with the latest LLVM - for example, see screen capture). And, according to Apple, I should be fine to use them: https://developer.apple.com/library/ios/#releasenotes/ObjectiveC/ObjCAvailabilityIndex/index.html

enter image description here

Xcode :

enter image description here

, Step over:

enter image description here

: ​​ :

NSDictionary *labelAttrs = [NSDictionary dictionaryWithObjectsAndKeys:[UIColor darkGrayColor], NSForegroundColorAttributeName, [UIFont fontWithName:CUSTOMFONT size:size], NSFontAttributeName, [NSNumber numberWithInt:0], NSStrokeWidthAttributeName, nil];

( ) , . , , .

UPDATE: . iOS5 ( UILabel's): NSAttributedString iOS 6?

+5
3

, NSAttributedString UIKit iOS 6. , NSForegroundColorAttributeName . . , , .

( - iOS (;)) - :

UIColor* value1 = [UIColor darkGrayColor];
NSString* key1 = NSForegroundColorAttributeName;
UIFont* value2 = [UIFont fontWithName:CUSTOMFONT size:size];
NString* key2 = NSFontAttributeName;
NSNumber* value3 = [NSNumber numberWithInt:0];
NSString* key3 = NSStrokeWidthAttributeName;

NSDictionary *labelAttrs0 = [NSDictionary dictionaryWithObjectsAndKeys:nil];
NSDictionary *labelAttrs1 = [NSDictionary dictionaryWithObjectsAndKeys:value1, key1, nil];
NSDictionary *labelAttrs2 = [NSDictionary dictionaryWithObjectsAndKeys:value2, key2, nil];
NSDictionary *labelAttrs3 = [NSDictionary dictionaryWithObjectsAndKeys:value3, key3, nil];

, . , , labelAttrs1. NSLog value1 key1, 1.)

+3

0x00000001 . Xcode ? lldb gdb

0

I saw 0x00000001 in lldb when im stepped over the code like this:

labelAttrs = [self someMethod];

If you print labelAttrs before evaluating -someMethod, then it will be assigned 0x00000001.

0
source

All Articles