In UIKit I have a single View created in Xcode. View How can I present or show that from View a UIViewController class after a button is hit? Because present(vc, animated: true) only works for ViewControllers...
CodePudding user response:
You must first connect it to the view property of some controller, and then present that controller
For this:
- Open your
View
(.xib) file - Select "File's Owner" in left section pane
- Select "Show the Attribute inspector" in right section pane
- Enter the class name of the ViewController that you want to attach this view to (for example:
MyViewController
) - Select "Show the Connections Inspector" in right section pane
- Connect view outlet to the your view
After that you can initialize your class and present in somewhere after tap/click