GithubHelp home page GithubHelp logo

khalidelsayed / scslidingviewcontroller Goto Github PK

View Code? Open in Web Editor NEW

This project forked from simoncoulton/scslidingviewcontroller

0.0 1.0 0.0 80 KB

A UIViewController that replicates similar functionality to ECSlidingViewController

License: MIT License

scslidingviewcontroller's Introduction

SCSlidingViewController

After seeing the following Dribbble shot, I figured it was probably the best solution for the sliding view controller on iOS7.

Dribble

SCSlidingViewController allows you to set one (or two) view controllers to be full height on iOS7 so that the color behind the statusbar can be controlled, while the top view sits below the status bar as per iOS6.

Usage

In your RootViewController.m, do the following to instantiate the left and right (either can be omitted) sides.

#import "RootViewController.h"
#import "TopViewController.h"
#import "MenuViewController.h"

@interface RootViewController () <SCSlidingViewControllerDelegate>

@end

@implementation RootViewController


- (void)viewDidLoad
{
    // Initial view controller, setup the views to be used.
    [super viewDidLoad];
    self.topViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"Top"];
    self.leftSideViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"Menu"];
    self.rightSideViewController = [self.storyboard instantiateViewControllerWithIdentifier:@"Context"];
}

@end

In your RootViewController.h file, make sure you subclass SCSlidingViewController

#import <UIKit/UIKit.h>
#import "SCSlidingViewController.h"

@interface RootViewController : SCSlidingViewController

@end

From any of your other view controllers, when you want to change the topViewController, simply call:

[self.slidingViewController changeTopViewController:[self.storyboard instantiateViewControllerWithIdentifier:@"YOUR VIEW CONTROLLER NAME"]];

Customizing the top view

The following are exposed (and should be straight forward in terms of functionality).

@property (nonatomic) int topViewOffsetY;
@property (nonatomic) int peakAmount;
@property (nonatomic) CGFloat cornerRadius;
@property (nonatomic) CGFloat shadowOpacity;
@property (nonatomic) CGFloat shadowOffsetX;
@property (nonatomic) CGFloat shadowOffsetY;
@property (retain, nonatomic) UIColor *shadowColor;
@property (nonatomic) CGFloat animationDuration;

Events

The following events are called when the top view is changed (but are not triggered via self.topViewController modifications).

- (void)willChangeTopViewController;
- (void)didChangeTopViewController;

Todo

  1. Be able to prevent the overswipe (displaying the left side, then swiping far enough to see the right and the reverse)
  2. Be able to set the status bar text color prior to the relevant side view controller being shown.
  3. Test on iOS6, though some small preliminary tests have been done and it seems to work.

scslidingviewcontroller's People

Contributors

simoncoulton avatar

Watchers

 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.