Show "tutorial" over UITabBarViewController with constraints in Swift?

20 Views Asked by At

An example of tutorial I need:

enter image description here

It is MYPassthrough library.

The problem is it works with frames only but I need constraints (to bind to appropriate views directly without of frame calculations)

Tried to add this semitransparent tutorial view to UITabBarController's view - it says Unable to activate constraint with anchors ... because they have no common ancestor. Does the constraint or its anchors reference items in different view hierarchies? That's illegal. (because I need to bind not to UITabBarController's content but to UITabBarController's children controller`s content).

Tried to to add this semitransparent tutorial view to inner view controllers - no error but now tabbar is not covered.

I also can't create 2 semitransparent views (one for tabbar and the second one for the rest screen) because it adds other problems.

Is it possible to resolve this with constraints and avoid direct frame calculations?

1

There are 1 best solutions below

0
Gargo On

Found a solution - the reason of the problem is I getting used to do all initialization in viewDidLoad - inside this method a view is created and is ready to use but is not added to existing view hierarchy!

So everything works if I delay tutorial initialization (for example call it from viewDidAppear)