Search code examples
swiftuiviewcontrollerswift2uipangesturerecognizeruicontainerview

How to move a container View in Swift


How to move a container View in Swift I'm working on an app that will be just for iPad, and because of the size I am using containers to embed other views. In this app, I need to move a viewController that is within a container.

For example, I created a ViewController and put a Container View. I must use the UIPanGesture in the label, and drag your finger across the screen, move the ContainerView in ViewControler Initial.

enter image description here

Can someone help me?


Solution

  • The container view is just a normal UIView.

    Just create a view outlet to your View Controller if you want to move the view using it's frame.

    You probably know how to create an outlet connection ?

    You can also use Auto Layout and created outlets to your constraints and change their value.