GithubHelp home page GithubHelp logo

kb100824 / zwintroductionviewcontroller Goto Github PK

View Code? Open in Web Editor NEW

This project forked from squarezw/zwintroductionviewcontroller

0.0 1.0 0.0 11.36 MB

A simple custom app introductions and tutorials and welcome video

License: MIT License

Objective-C 84.61% Swift 15.39%

zwintroductionviewcontroller's Introduction

What?

Introduction View

It will display a fullscreen swipeable modal window to guide the user through a welcome screen / tutorial

  • Video

Screenshot

  • Cover

Screenshot

  • Simple Version

Sample application screenshot

Usage?

Swift

        // data source
        self.coverImageNames = ["img_index_01txt","img_index_02txt", "img_index_03txt"]
        self.backgroundImageNames = ["img_index_01bg","img_index_02bg", "img_index_03bg"]
        self.coverTitles = ["MAKE THE WORLD", "THE BETTER PLACE"]
        
        let filePath = NSBundle.mainBundle().pathForResource("intro_video", ofType: "mp4")
        self.videoURL = NSURL.fileURLWithPath(filePath!)
        
        // Added Introduction View
        
//        self.introductionView = self.simpleIntroductionView()
        
//        self.introductionView = self.coverImagesIntroductionView()
        
//        self.introductionView = self.customButtonIntroductionView()
        
        self.introductionView = self.videoIntroductionView();
        
//        self.introductionView = self.advanceIntroductionView();
        
        self.window?.addSubview(self.introductionView)
        
        self.introductionView!.didSelectedEnter = {
            self.introductionView!.removeFromSuperview()
            self.introductionView = nil;
            // enter main view , write your code ...
        }
        
    // Example 1 : Simple
    func simpleIntroductionView() -> ZWIntroductionView {
        let vc = ZWIntroductionView(coverImageNames: self.backgroundImageNames)
        return vc
    }

    // Example 2 : Cover Images
    func coverImagesIntroductionView() -> ZWIntroductionView {
        let vc = ZWIntroductionView(coverImageNames: self.coverImageNames, backgroundImageNames: self.backgroundImageNames)
        return vc
    }
    
    // Example 3 : Custom Button
    func customButtonIntroductionView() -> ZWIntroductionView {
        let enterButton = UIButton()
        enterButton.setBackgroundImage(UIImage(named: "bg_bar"), forState: .Normal)
        enterButton.setTitle("Login", forState: .Normal)
        let vc = ZWIntroductionView(coverImageNames: self.coverImageNames, backgroundImageNames: self.backgroundImageNames, button: enterButton)
        return vc
    }
    
    // Example 4 : Video
    func videoIntroductionView() -> ZWIntroductionView {
        let vc = ZWIntroductionView(video: self.videoURL)
        vc.coverImageNames = self.coverImageNames
        vc.autoScrolling = true
        return vc
    }
    
    // Example 5 : Advance
    func advanceIntroductionView() -> ZWIntroductionView {
        let loginButton = UIButton(frame: CGRectMake(3, self.window!.frame.size.height - 60, self.window!.frame.size.width - 6, 50))
        loginButton.backgroundColor = UIColor.init(white: 1, alpha: 0.5)
        loginButton.setTitle("Login", forState: .Normal)
        let vc = ZWIntroductionView(video: self.videoURL, volume: 0.7)
        vc.coverImageNames = self.coverImageNames
        vc.autoScrolling = true
        vc.hiddenEnterButton = true
        vc.pageControlOffset = CGPointMake(0, -100)
        vc.labelAttributes = [NSFontAttributeName: UIFont(name: "Arial-BoldMT", size: 28.0)!,
                              NSForegroundColorAttributeName: UIColor.whiteColor()]
        vc.coverView = loginButton
        
        vc.coverTitles = self.coverTitles
        
        return vc
    }
            

Objective-C

	// data source

    self.coverImageNames = @[@"img_index_01txt", @"img_index_02txt", @"img_index_03txt"];
    self.backgroundImageNames = @[@"img_index_01bg", @"img_index_02bg", @"img_index_03bg"];
    self.coverTitles = @[@"MAKE THE WORLD", @"THE BETTER PLACE"];

    NSString *filePath = [[NSBundle mainBundle] pathForResource:@"intro_video" ofType:@"mp4"];
    self.videoURL = [NSURL fileURLWithPath:filePath];

    // Added Introduction View
    
//    self.introductionView = [self simpleIntroductionView];
    
//    self.introductionView = [self coverImagesIntroductionView];
    
//    self.introductionView = [self customButtonIntroductionView];
    
    self.introductionView = [self videoIntroductionView];
    
//    self.introductionView = [self advanceIntroductionView];

    
    [self.window addSubview:self.introductionView];
    
    __weak AppDelegate *weakSelf = self;
    self.introductionView.didSelectedEnter = ^() {
        [weakSelf.introductionView removeFromSuperview];
        weakSelf.introductionView = nil;
    };

Take a look at the Example project to see how to use customization using more

Installation?

This project includes a podspec for usage with CocoaPods. Simply add

pod 'ZWIntroductionViewController'

to your Podfile and run pod install.

Alternately, you can add all of the files contained in this project's Library directory to your Xcode project. If your project does not use ARC, you will need to enable ARC on these files. You can enabled ARC per-file by adding the -fobjc-arc flag, as described on a common StackOverflow question.

License

This project is licensed under the MIT license. All copyright rights are retained by myself.

Copyright (c) 2015 Square

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

zwintroductionviewcontroller's People

Contributors

squarezw 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.