Skip to content

Commit

Permalink
update readme
Browse files Browse the repository at this point in the history
  • Loading branch information
0ber committed Apr 28, 2016
1 parent 6f7fb82 commit 9ed7a07
Show file tree
Hide file tree
Showing 2 changed files with 72 additions and 4 deletions.
17 changes: 17 additions & 0 deletions PaperOnboardingDemo/PaperOnboardingDemo/ViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,23 @@ class ViewController: UIViewController {
override func viewDidLoad() {
super.viewDidLoad()

// EXAMPLE USE FROM CODE

// let onboarding = PaperOnboarding(itemsCount: 3, dataSource: self)
// onboarding.translatesAutoresizingMaskIntoConstraints = false
// view.addSubview(onboarding)
//
// // add constratins
// for attribute: NSLayoutAttribute in [.Left, .Right, .Top, .Bottom] {
// let constraint = NSLayoutConstraint(item: onboarding,
// attribute: attribute,
// relatedBy: .Equal,
// toItem: view,
// attribute: attribute,
// multiplier: 1,
// constant: 0)
// view.addConstraint(constraint)
// }
}

override func didReceiveMemoryWarning() {
Expand Down
59 changes: 55 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
[![CocoaPods](https://img.shields.io/cocoapods/p/paper-onboarding.svg)](https://cocoapods.org/pods/paper-onboarding)
[![CocoaPods](https://img.shields.io/cocoapods/v/paper-onboarding.svg)](http://cocoapods.org/pods/paper-onboarding)
[![Travis](https://img.shields.io/travis/Ramotion/navigation-stack.svg)](https://travis-ci.org/Ramotion/navigation-stack)
<!-- [![codebeat badge](https://codebeat.co/badges/c322a039-b06b-46d9-bf40-e48cf0365b97)](https://codebeat.co/projects/github-com-ramotion-navigation-stack) -->
[![codebeat badge](https://codebeat.co/badges/d06237c6-6ff7-4560-9602-b6cc65063383)](https://codebeat.co/projects/github-com-ramotion-paper-onboarding)

<!-- [shot on dribbble](https://dribbble.com/shots/2583175-Navigation-Stack-Swift-Open-Source): -->
<!-- ![Animation](Navigation-Stack.gif) -->
Expand All @@ -14,7 +14,7 @@

## Requirements

- iOS 9.0+
- iOS 8.0+
- Xcode 7.3

## Installation
Expand All @@ -28,8 +28,59 @@ pod 'Navigation-stack', '~> 0.0.1'

## Usage

<!-- ``` swift
``` -->
#### Storyboard

1) Create a new UIView inheriting from ```PaperOnboarding```

2) Set itemsCount in attribute inspector

#### or Code

``` swift
override func viewDidLoad() {
super.viewDidLoad()

let onboarding = PaperOnboarding(itemsCount: 3, dataSource: self)
onboarding.translatesAutoresizingMaskIntoConstraints = false
view.addSubview(onboarding)

// add constratins
for attribute: NSLayoutAttribute in [.Left, .Right, .Top, .Bottom] {
let constraint = NSLayoutConstraint(item: onboarding,
attribute: attribute,
relatedBy: .Equal,
toItem: view,
attribute: attribute,
multiplier: 1,
constant: 0)
view.addConstraint(constraint)
}
}
```

#### For adding content use delegate methods:

``` swift
func onboardingItemAtIndex(index: Int) -> OnboardingItemInfo {
return [
("BIG_IMAGE1", "Hotels", "All hotels and hostels are sorted by hospitality rating"),
("BIG_IMAGE2", "Banks", "We carefully verify all banks before add them into the app"),
("BIG_IMAGE3", "Stores", "All local stores are categorized for your convenience")
][index]
}

func onboardingBackgroundColorItemAtIndex(index: Int) -> UIColor {
return [
UIColor(red:0.40, green:0.56, blue:0.71, alpha:1.00),
UIColor(red:0.40, green:0.69, blue:0.71, alpha:1.00),
UIColor(red:0.61, green:0.56, blue:0.74, alpha:1.00)][index]
}

func pageViewIconAtIndex(index: Int) -> UIImage? {
let imageNames = ["ICON1", "ICON2", "ICON3"]
return UIImage(asset: imageNames[index])
}
```

## Licence

Expand Down

0 comments on commit 9ed7a07

Please sign in to comment.