簡體   English   中英

iOS擴展UIWindow禁用了根視圖控制器?

[英]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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM