0

I'm trying to add TopView in my application, it will be the same for each views. I do it like this

let vcTopMenu = storyboard?.instantiateViewControllerWithIdentifier("TopMenu")
        let win:UIWindow = UIApplication.sharedApplication().delegate!.window!!
        win.rootViewController = vcTopMenu
        win.makeKeyAndVisible()

But when I add other viewControllers (I do it transparent) I can see buttons of TopView, but I can't click on it. It's a code from TopView

override func viewDidLoad()
{
    super.viewDidLoad()
    print("loaded")
} 

@IBAction func btn(sender: AnyObject)
{
    print("do something")
}

I see "loaded", but clicking doesn't work, how can I click through view? Thanks!

Alexander B
  • 137
  • 2
  • 12
  • 1
    Hi Alexander, did you finally manage to do that ? If so, can you answer your topic and explain your solution ? That would really help me.. thanks ;) – Quentin Rth Feb 18 '20 at 16:37
  • Hi! Unfortunately that time I changed all app logic, and, as I remember, I did some kind of ContainerView, that I've changed by click on my menu button. For now I'm understand that better idea is create base viewController and after extend them. Hope, you'll fix your issue! – Alexander B Feb 24 '20 at 15:56

1 Answers1

-1

If I understand your question correctly, you're placing a translucent/transparent UIView on top of another UIView with a button you want to press?

The topmost UIView by default receives the touches. More on this here.

It's not a very standard/practical way to do things, but if you absolutely must, check out this answer: https://stackoverflow.com/a/4010809/4396258

Community
  • 1
  • 1
Mark
  • 12,359
  • 5
  • 21
  • 37
  • No, I try to add UIViewController under other UIViewController like a part of rootViewController, but thanks for help! – Alexander B Mar 01 '16 at 10:18