I'm new to Objective C for iPhone. I tried the following code to get the screen size, however the code below returns two different result:
CGRect screenRect = [UIScreen mainScreen].bounds;
NSLog(@"width: %d", screenRect.size.width);
NSUInteger width = [UIScreen mainScreen].bounds.size.width;
NSUInteger height = [UIScreen mainScreen].bounds.size.height;
NSLog(@"width: %d", width);
The first NSLog outputs 0, while the last one outputs 320. Why are they different? Does it have something to do with pointers? Please help.