Table of Contents
- 1 Steps to Completion:
- 2 1. Create a singleView Project, delete the StoryBoard that Xcode created for you and remove Main as Main Interface from Project Deployment Info
- 3 2. Edit AppDelegate.swift setting the root view controller (in this case it will be an UITableViewController)
- 4 3. Create the controllers and add subviews to controllers
- 5 4. Define constraints for each UIView using Auto Layout with visual format
- 6 5. Create transitions between controllers
Steps to Completion:
- Create a singleView Project, delete the StoryBoard that Xcode created for you and remove Main as Main Interface from Project Deployment Info
- Edit AppDelegate.swift setting the root view controller (in this case it will be an UITableViewController)
- Create the constrollers and add subviews to controllers
- Define constraints for each UIView using Auto Layout with visual format
- Create transitions between controllers
1. Create a singleView Project, delete the StoryBoard that Xcode created for you and remove Main as Main Interface from Project Deployment Info
No secrets here, since its an advanced tutorial i will assume you know what i am talking about. Everything is shown visually in the vídeo bellow.
2. Edit AppDelegate.swift setting the root view controller (in this case it will be an UITableViewController)
window = UIWindow(frame: UIScreen.mainScreen().bounds) window?.makeKeyAndVisible() //makes the key window and visible let controller = MyCustomTableViewController() let navigationController = UINavigationController(rootViewController: controller) window?.rootViewController = navigationController
3. Create the controllers and add subviews to controllers
In this step controllers must be created. These controllers will be called by the buttons out in the table cells inside the table view controllers.
– To create a controller create a new file and subclass UIViewController
– Add subviews as needed. I will create just labels and buttons for each controller
4. Define constraints for each UIView using Auto Layout with visual format
In the vídeo there is a good explanation of how to use Auto Layout with visual formatting
5. Create transitions between controllers
To create transitions between controller the method showViewController(vc: UIViewController, sender: AnyObject?). But before calling it the controller must be prepared.
controller = SomeViewController() //this is the controller that will be presented controller.modalPresentationStyle = UIModalPresentationStyle.PageSheet; //define presentation style controller.modalTransitionStyle = UIModalTransitionStyle.CoverVertical //define transition style showViewController(controller, sender: self) //calls the controller
What do you think?