iPhone开发技巧之私有API--- UIApplication
2012-03-13 18:49
531 查看
如果我们继承了UIApplication,就可以捕捉到应用程序发生的各种事件。首先,像下面这样实现你的 main 方法。
UIApplicationMain 函数的第三个参数中放入继承的UIApplication类名称。第四个参数是委托类(UIApplicationDelegate)的名称。
只要你重载了该类中的函数,就可以hook许多有用的事件。比如下面的方法:
我们可以重载一些私有的API,来实现一些特殊的处理。你可以查看这里得到更多信息。
比如点击了状态条的事件。
int main(int argc, char *argv[]) { NSAutoreleasePool * pool = [[NSAutoreleasePool alloc] init]; int retVal = UIApplicationMain(argc, argv, @"MyApplication", @"MyAppDelegate"); [pool release]; return retVal; }
UIApplicationMain 函数的第三个参数中放入继承的UIApplication类名称。第四个参数是委托类(UIApplicationDelegate)的名称。
只要你重载了该类中的函数,就可以hook许多有用的事件。比如下面的方法:
- (void)applicationWillSuspend;
我们可以重载一些私有的API,来实现一些特殊的处理。你可以查看这里得到更多信息。
比如点击了状态条的事件。
- (void)statusBarMouseDown:(struct __GSEvent *)fp8; - (void)statusBarMouseDragged:(struct __GSEvent *)fp8; - (void)statusBarMouseUp:(struct __GSEvent *)fp8;
相关文章推荐
- iPhone开发技巧之私有API(8)--- UIApplication
- iPhone开发技巧之私有API--- UITableView
- iPhone开发技巧之私有API(5)--- UISegmentedControl
- iPhone开发技巧之私有API--- UIBarButtonItem
- iPhone开发技巧之私有API(6)--- 设置UIWebView中的User-Agent
- iPhone开发技巧之私有API--- 设置UIWebView中的User-Agent
- iPhone开发技巧之私有API(7)--- 用UIWebView访问BASIC认证的页面
- iPhone开发技巧之私有API--- 用UIWebView访问BASIC认证的页面
- iPhone开发技巧之私有API
- iPhone开发技巧之私有API — 设备相关信息
- 转:iPhone开发技巧之私有API(1) — 设备相关信息
- iPhone开发技巧之私有API(4)— UIBarButtonItem
- iPhone开发技巧之私有API--- UIBarButtonItem
- iPhone开发技巧之私有API(2)— UITableView
- iPhone开发技巧之私有API(6)--- 设置UIWebView中的User-Agent
- iPhone开发技巧之私有API — 设备相关信息
- iPhone开发技巧之私有API(3)--- UIButton
- iPhone开发技巧之私有API(2)--- UITableView
- iPhone开发技巧之私有API --- 设备相关信息
- iPhone开发技巧之私有API(1) --- 设备相关信息