Search code examples
iosuibuttonwindowtouch

UIButton added in keywindow never fired


I want to add button on most Top Window.

If I add UIButton in [UIApplication sharedApplication].keyWindow. It shows as I expect. But never fired. I tried to add tap gesture on UIView. never fired. any UIView on top window. never fired.

How could I make it? I don't have navigationcontroller so it's not an option for me.

Thanks.


Solution

  • I did mistake.

    I added button on UIView, which is coming from outside from screen. Yes, I made animate that view with using set NSLayoutConstraint.

    I tried animation option for allowUserInteraction but no luck.

    My button's disappearing animation is written in complete callback of appearing animation, and it's staying 2 seconds with using animate's delay property.

    It may cause that problem.

    I ended up split those animataion. It's working fine now.