Giter Club home page Giter Club logo

animatingsplitviewcontroller's Introduction

AnimatingSplitViewController

This project has 2 examples (Targets/Apps) of using the AnimationSplitViewController. This is more of a demonstration of a concept than a widget to plug in to an App. Split Examples

Note: This project only contains the UI manipulations. The data flow is left a job for you. In my App implementation the data flow ended up pretty clean. Did need to a capture references to the detail viewcontroller in the AnimatingSplitViewController. Then in storyboard added push detail segue between master and detail. In code, I implemented shouldPerformSegueWithIdentifier() to pass data to detail view controller and set the correct display by calling splitDelegate.showDetail(). Note that this method then returns false. Otherwise, the UIKit framework will create an new instance of the DetailViewController, but we never need that because we always have one available. This is also why this is done in shouldPerformSegueWithIdentifier() instead of prepareForSegue() where the view controller is already created.

  • AniSplitView - Has constraints created in code. Not recommended, but kinda cool because it configures itself.
  • AniSplitViewSimple - The constraints must be set in IB and the IBOutlets set for the views and 3 primary constraints.

This exploration was motivated when I ran into difficulty customizing a UISplitViewController and realize that it is not very flexible and might not be the correct choice if you do not like the default behavior. Key features I wanted include:

  • Split available on all iPhones in Landscape.
  • No UINavigationController header for detail.
  • Split without overlay on iPad.
  • Play nicely with iOS9 iPad SlideOver and SplitView.

A movie best demonstrates some of these features: Example Movie

AniSplitViewSimple

Rather than build constraints in code, this project has them set in IB. This is the way I intend to use this code. The two key views (masterView and detailView) as well as the 3 Key Constraints are set as @IBOutlets. This removes the need for the setupConstraints() method which is the most confusing and complex (and problematic?) part of this. Also, the hack(?) to find the masterView and detailView is avoided.

Split States

Notes on UISplitViewController

  • Seems a bit strange
  • Does not follow size classes
  • Requires UINavigationControllers
  • Semi custom Push Detail Segue
  • Hard to customize

AniSplitView

Please note that I decided to NOT persue this implementation although it is pretty neat in that the wiring up IB is pretty easy and all the constraint work is done in code. But that was turning out to be more complicated than I wanted to deal with.

Usage in IB:

  1. Add a view controller, set as a AnimatingSplitViewController.
  2. (Optional, but expected) Add plain UIView as a container if you want to contain the split view.
  3. Drag in 2 Container views.
  4. Have one implement AnimatingSplitMasterViewController (var splitDelegate:AnimatingSplitViewControllerDelegate!).
  5. Have one implement AnimatingSplitDetailViewController (var splitDelegate:AnimatingSplitViewControllerDelegate!).
  6. Code Master and Detail with calls to AnimatingSplitViewControllerDelegate as desired.

Possible enhancements:

  • Add SplitState WideMaster, to enable a full screen master mode.
  • Custom transitions, or match UISplitViewController transitions.
  • Package in library. Well beyond scope of this work.

animatingsplitviewcontroller's People

Contributors

eelfner avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.