Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>You can subclass UIApplication:</p> <ul> <li>Create an UIApplication Subclass</li> <li>override the <code>-(BOOL)sendAction:(SEL)action to:(id)target from:(id)sender forEvent:(UIEvent *)event</code> method, remember to call the super implementation</li> <li>put an <code>NSLog</code> or other diagnostic code inside the implementation</li> </ul> <p>Example, this will print a log every time an UIButton is pressed:</p> <pre><code>-(BOOL)sendAction:(SEL)action to:(id)target from:(id)sender forEvent:(UIEvent *)event { if ([sender isKindOfClass:[UIButton class]]) { NSLog(@"Action: %@ - %@ - %@", NSStringFromSelector(action), target, sender); } return [super sendAction:action to:target from:sender forEvent:event]; } 2013-07-08 14:46:18.270 UIApplicationSubclass[94764:c07] Action: anAction: - &lt;ViewController: 0x76790a0&gt; - &lt;UIRoundedRectButton: 0x767b9b0; frame = (103 66; 73 44); opaque = NO; autoresize = TM+BM; layer = &lt;CALayer: 0x767bad0&gt;&gt; 2013-07-08 14:46:27.378 UIApplicationSubclass[94764:c07] Action: anAction: - &lt;ViewController: 0x76790a0&gt; - &lt;UIRoundedRectButton: 0x767b9b0; frame = (103 66; 73 44); opaque = NO; autoresize = TM+BM; layer = &lt;CALayer: 0x767bad0&gt;&gt; </code></pre> <p>Moreover, to subclass UIApplication, you must change the main.m file like this (In my case the UIApplication subclass was named FLApplication, look at the third parameter of the UIApplicationMain function and the import of FLApplication.h)</p> <pre><code>#import "AppDelegate.h" #import "FLApplication.h" int main(int argc, char *argv[]) { @autoreleasepool { return UIApplicationMain(argc, argv, NSStringFromClass([FLApplication class]), NSStringFromClass([AppDelegate class])); } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload