关于UIApplication的sendEvent方法的一个问题

发布于 2024-11-15 09:43:47 字数 461 浏览 6 评论 0原文

我重写 UIApplication 的 - (void)sendEvent:(UIEvent *)event 方法来处理某些触摸事件。

.h

@interface myUIApplication : UIApplication {

}

.m

@implementation myUIApplication

- (void)sendEvent:(UIEvent *)event {
    NSLog(@"a event catched");
    [super sendEvent:event];
}

@end

,我将文件所有者的类编辑为 MainWindow.xib 中的 myUIApplication。 但当我触摸屏幕时 没有像@“捕获事件”这样的输出

我有什么错误吗?

谢谢!

I override the - (void)sendEvent:(UIEvent *)event method of UIApplication to handle some touch event.

.h

@interface myUIApplication : UIApplication {

}

.m

@implementation myUIApplication

- (void)sendEvent:(UIEvent *)event {
    NSLog(@"a event catched");
    [super sendEvent:event];
}

@end

and I edit my File's Owner's class to myUIApplication in MainWindow.xib.
But when I touch the screen
There is no output like @"a event catched"

Is there some mistake I have?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

拒绝两难 2024-11-22 09:43:47

您必须将 @"myUIApplication" 传递给 UIApplicationMain 函数。所以应该是这样,

int retVal = UIApplicationMain(argc, argv, @"myUIApplication", nil);

You will have to pass @"myUIApplication" to UIApplicationMain function. So it should be,

int retVal = UIApplicationMain(argc, argv, @"myUIApplication", nil);
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文