Graphics Programs Reference
In-Depth Information
Adding this value to this setting says, “When you are building the TouchTracker target
with the debug configuration, a preprocessor macro VIEW_DEBUG is defined.”
Let's add some debugging code to TouchTracker that will only be compiled when the tar-
get is built with the debug configuration. UIView has a private method recursiveDe-
scription that prints out the entire view hierarchy of an application. However, you
cannot call this method in an application that you deploy to the App Store, so you will
only allow it to be called if VIEW_DEBUG is defined.
In AppDelegate.m , add the following code to applica-
tion:didFinishLaunchingWithOptions: .
[self.window makeKeyAndVisible];
#ifdef VIEW_DEBUG
NSLog(@"%@", [[self window] performSelector:@selector(recursiveDescription)]);
#endif
return YES;
}
This code will send the message recursiveDescription to the window. (Notice the
use of performSelector: . recursiveDescription is a private method, so we
have to dispatch it in this way.) recursiveDescription will print a view's descrip-
Search WWH ::




Custom Search