[英]iOS Extending UIWindow disabled the root view controller?
球队,
我扩展了UIWindow
,这使我的着陆视图控制器( rootViewController
)被禁用,即,我无法与其进行交互。
EBaseUIWindow
是将UIWindow
作为超类的类。 当我用UIWindow
替换EBaseUIWindow
,我可以与rootViewController
进行交互。
请问是什么原因?
self.window = [[EBaseUIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] ;
self.viewController = [[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] ;
self.window.rootViewController = self.viewController;
[self.window makeKeyAndVisible];
return YES;
请提出建议?
在我的代码中进行下面的编辑之后,工作:
我在sendEvent
重写了sendEvent
方法。 这样,当我添加以下行时,它开始工作。
[super sendEvent:event];
感谢Daij-Djan的线索。
没有看到您的自定义类的任何代码,这有点..猜测..可能有很多原因。
但
在某种程度上,它取决于您的窗口类(或它添加的视图或识别器)在事件到达rootViewController视图之前就对其进行了消耗。
确定与您接触的地方(一般事件)并注释掉,以查看引起问题的原因
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.