yshrkt / VuforiaSampleSwift

Vuforia sample code with SceneKit using Swift
MIT License
123 stars 24 forks source link

Is it possible to work with this solution and Interface Builder? #23

Open jarrillaga opened 7 years ago

jarrillaga commented 7 years ago

I want to use your solution because is great but it would be very usefull to use Interface Builder to add some fixed elements above the scene. I now that I can add them in the prepare() function of my ViewController but I really prefear to work in IB because of the AutoLayout constraints.

Is it possible to do use IB in a quick way or it is too hard to change this?

Thanks !

yshrkt commented 7 years ago

Hi, @jarrillaga

You can use Interface Builder, but you can not add directly UI elements above the scene using IB. You may construct UI using IB like below.

  1. Create view controller for UI elements using IB. (eg. viewControllerA)
  2. And adds container view to ViewControllerA (below UI elements). (eg. viewControllerA.containerView)
  3. Create view controller for Vuforia Scene. (eg. viewControllerB)
  4. Adds viewControllerB as child view controller to viewControllerA.
Meonardo commented 7 years ago

@yshrkt is right, add EAGLView as subView of ViewController's view and add sibling views(the view you want to add via IB) for EAGLView. Be sure the EAGLView is low hierarchy than the sibling views you add.

self.eaglView = manager.eaglView self.eaglView.frame = CGRect(origin: CGPoint.zero, size: UIScreen.main.bounds.size) self.view.insertSubview(eaglView, at: 0)