Giter Site home page Giter Site logo

shrikanth2002 / mmparallaxpresenter Goto Github PK

View Code? Open in Web Editor NEW

This project forked from prathumca/mmparallaxpresenter

0.0 2.0 0.0 24.89 MB

iOS Custom UIScrollView Class to display static text / views with a vertical parallax effect

License: MIT License

Objective-C 100.00%

mmparallaxpresenter's Introduction

MMParallaxPresenter


Example Setup

  1. Clone the repo and drag the MMParallaxPresenter folder into your project. This should include MMHeaderUIView.h/.m, MMParallaxPage.h/.m, and MMParallaxPresenter.h/.m

  2. Drag and drop a UIScrollView into your Interface Builder and under the custom class section, subclass your UIScrollView to MMParallaxPresenter

  3. Now add: @property (weak, nonatomic) IBOutlet MMParallaxPresenter *mmParallaxPresenter; to your list of properties and dont forget to link it up in your Interface Builder

  4. Add a MMParallaxPage to the MMScrollPresenter. To do this, you have three init methods at your disposal. All the default views are shown in the above gif in this order:

     -(id)initWithScrollFrame:(CGRect)scrollFrame withHeaderHeight:(int)height andContentText:(NSString *)contentText;
     
     -(id)initWithScrollFrame:(CGRect)scrollFrame withHeaderHeight:(int)height withContentText:(NSString *)contentText andContextImage:(UIImage *)image;
     
     -(id)initWithScrollFrame:(CGRect)scrollFrame withHeaderHeight:(int)height andContentView:(UIView *)contentView;
    
  • Here is the snippet of code slightly modified from the example app included in the repo. This shows how to initalize and setup a page and add it to your presenter:

      MMParallaxPage *page1 = [[MMParallaxPage alloc] initWithScrollFrame:self.mmParallaxPresenter.frame withHeaderHeight:150 andContentText:[self sampleText]];
      [page1.headerLabel setText:@"Section 1"];
      [page1.headerView addSubview:[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"stars.jpeg"]]];
      
      [self.scrollView addParallaxPageArray:@[page1]];
    

License

MMParallaxPresenter is available under the MIT license. See the LICENSE file for more info.

mmparallaxpresenter's People

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.