Game Development Reference
In-Depth Information
Listing 14-5 . There are two ways of printing a point
CGPoint point = CGPointMake(1024, 768);
NSLog(@"point=%.0fx%.0f point=%@", point.x, point.y,
NSStringFromCGPoint(point));
The output of NSStringFromCGPoint is formatted in the same format required by the
inverse conversion function CGPointFromString , which takes a string like {1024,
768} and returns a CGPoint . Here's the output of Listing 14-5 :
point=1024x768 point={1024, 768}
Tip You'll need the format specifiers frequently for NSLog , NSAssert , and
NSString . The full list with descriptions is available at ht-
tps://developer.apple.com/library/mac/documentation/
Cocoa/Conceptual/Strings/Articles/formatSpeci-
fiers.html .
One last thing: it's not unusual to leave commented-out NSLog statements in your code.
Eventually, you may need them again, so this will save you time. If you haven't used a
commented-out NSLog statement in weeks, and it doesn't look like you're ever going to
need it again, feel free to remove it.
Adding an Exception Breakpoint (Xcode
5)
Before moving on to assertions, there's one crucial item you should always add to your
project if you are using Xcode 5: the exception breakpoint. I find it so important that I've
added instructions to add the exception breakpoint early in the topic. Here I'd like to show
you how to add it and what difference it makes.
Tip Xcode 6 users will appreciate that adding an exception breakpoint is no
longer necessary to have Xcode point to the offending line of code.
Search WWH ::




Custom Search