序号 | 录入时间 | 录入人 | 备注 |
---|---|---|---|
1 | 2016-04-14 | Alfred Jiang | - |
UIEvent - iOS 事件拦截
UIEvent \ 事件拦截 \ 捕获任意点击事件
- 需要响应任意点击事件
- 需要接收任意交互事件信息
#####1. 新建一个自定义的 MyApplication 继承自 UIApplication,在 MyApplication 中实现 *-(void)sendEvent:(UIEvent )event 方法
- (void)sendEvent:(UIEvent*)event
{
//接收 event 并发送通知
[[NSNotificationCenter defaultCenter] postNotificationName:NotificationMyApplicationSendEvent object:event];
[super sendEvent:event];
}
#####2. 修改 main.m 中 *int main(int argc, char argv[]) 方法
int main(int argc, char *argv[])
{
@autoreleasepool {
return UIApplicationMain(argc, argv, NSStringFromClass([MyApplication class]), NSStringFromClass([AppDelegate class]));
}
}
(无)
(无)