iOS UI Elements Split View - IOS

What is the use of Split View?

Split View is iPad specific container, view controller for managing two view controllers side by side, a master in the left and a detail view controller to its right.

Important Properties

  • delegate
  • viewControllers

Sample code and steps

Step 1. Create a new project and select Master Detail Application instead of the View Based application and click next, Give the project name and select create.

Step 2. A simple split view controller with a table view in master is created by default.

Step 3. The files created a little bit different from our View Based application. Here, we have the following files created for us.

  • AppDelegate.h
  • AppDelegate.m
  • DetailViewController.h
  • DetailViewController.m
  • DetailViewController.xib
  • MasterViewController.h
  • MasterViewController.m
  • MasterViewController.xib

Step 4. AppDelegate.h file is as follows −

Step 5.The didFinishLaunchingWithOptions method in AppDelegate.m is as follows −

Step 6. MasterViewController.h is as follows −

Step 7. MasterViewController.m is as follows −

Step 8. DetailViewController.h as follows −

Step 9. DetailViewController.m as follows −

Step 10. When we run the application we'll get the following output in landscape mode −

iOS - Split View

Step 11. We'll get the following output when we switch to the portrait mode −

iOS - Split View

All rights reserved © 2020 Wisdom IT Services India Pvt. Ltd Protection Status

IOS Topics