Skip to content

Commit

Permalink
version 0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
aryaxt committed Mar 14, 2015
1 parent c3672bf commit 608ee42
Show file tree
Hide file tree
Showing 4 changed files with 84 additions and 15 deletions.
22 changes: 22 additions & 0 deletions License.txt
@@ -0,0 +1,22 @@
Created by Aryan Gh on 3/14/15.
Copyright (c) 2013 Aryan Ghassemi. All rights reserved.

https://github.com/aryaxt/ScrollPager

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.
53 changes: 39 additions & 14 deletions ScrollPager/Base.lproj/Main.storyboard
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6254" systemVersion="14C109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<document type="com.apple.InterfaceBuilder3.CocoaTouch.Storyboard.XIB" version="3.0" toolsVersion="6751" systemVersion="14C109" targetRuntime="iOS.CocoaTouch" propertyAccessControl="none" useAutolayout="YES" useTraitCollections="YES" initialViewController="BYZ-38-t0r">
<dependencies>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6247"/>
<plugIn identifier="com.apple.InterfaceBuilder.IBCocoaTouchPlugin" version="6736"/>
<capability name="Constraints to layout margins" minToolsVersion="6.0"/>
</dependencies>
<scenes>
Expand Down Expand Up @@ -46,6 +46,9 @@
<userDefinedRuntimeAttribute type="number" keyPath="borderWidth">
<real key="value" value="0.59999999999999998"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="number" keyPath="animationDuration">
<real key="value" value="0.20000000000000001"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<variation key="default">
<mask key="constraints">
Expand All @@ -57,6 +60,9 @@
<include reference="EWS-Dd-Dui"/>
</mask>
</variation>
<variation key="widthClass=regular" ambiguous="YES">
<rect key="frame" x="0.0" y="0.0" width="0.0" height="0.0"/>
</variation>
<connections>
<outlet property="scrollView" destination="cuB-zv-A7f" id="f6B-K7-nTY"/>
</connections>
Expand All @@ -81,6 +87,9 @@
<userDefinedRuntimeAttribute type="color" keyPath="borderColor">
<color key="value" red="0.90196079015731812" green="0.90196079015731812" blue="0.90196079015731812" alpha="1" colorSpace="calibratedRGB"/>
</userDefinedRuntimeAttribute>
<userDefinedRuntimeAttribute type="number" keyPath="animationDuration">
<real key="value" value="0.14999999999999999"/>
</userDefinedRuntimeAttribute>
</userDefinedRuntimeAttributes>
<variation key="default">
<mask key="constraints">
Expand All @@ -98,15 +107,19 @@
<constraints>
<constraint firstItem="wfy-db-euE" firstAttribute="top" secondItem="cuB-zv-A7f" secondAttribute="bottom" id="2Sy-at-XIM"/>
<constraint firstItem="cuB-zv-A7f" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" id="7YR-p4-IaP"/>
<constraint firstItem="QQO-QE-UpB" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" id="FmS-Lj-6pH"/>
<constraint firstItem="QQO-QE-UpB" firstAttribute="top" secondItem="y3c-jy-aDJ" secondAttribute="bottom" constant="2" id="JFK-rp-eX4">
<variation key="widthClass=compact" constant="0.0"/>
</constraint>
<constraint firstAttribute="trailing" secondItem="QQO-QE-UpB" secondAttribute="trailing" constant="600" id="PBj-nY-3b0"/>
<constraint firstItem="wfy-db-euE" firstAttribute="top" secondItem="I5s-Er-1u6" secondAttribute="bottom" id="Zq3-Xj-4d9"/>
<constraint firstAttribute="trailing" secondItem="cuB-zv-A7f" secondAttribute="trailing" id="bpk-AS-OO4"/>
<constraint firstAttribute="bottom" secondItem="QQO-QE-UpB" secondAttribute="bottom" constant="400" id="c7R-F9-4WS"/>
<constraint firstItem="QQO-QE-UpB" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leadingMargin" constant="-16" id="dbK-ZS-pQb"/>
<constraint firstItem="QQO-QE-UpB" firstAttribute="top" secondItem="y3c-jy-aDJ" secondAttribute="bottom" constant="2" id="gHi-rw-64L"/>
<constraint firstAttribute="trailing" secondItem="I5s-Er-1u6" secondAttribute="trailing" id="kUV-Fh-4eg"/>
<constraint firstItem="wfy-db-euE" firstAttribute="top" secondItem="QQO-QE-UpB" secondAttribute="bottom" constant="540" id="oaN-tT-Wel"/>
<constraint firstItem="QQO-QE-UpB" firstAttribute="top" secondItem="8bC-Xf-vdC" secondAttribute="top" id="pOV-x6-5ye"/>
<constraint firstAttribute="trailingMargin" secondItem="QQO-QE-UpB" secondAttribute="trailing" constant="-16" id="tFs-ag-Lhh"/>
<constraint firstItem="I5s-Er-1u6" firstAttribute="leading" secondItem="8bC-Xf-vdC" secondAttribute="leading" id="vKM-q3-pRK"/>
<constraint firstItem="cuB-zv-A7f" firstAttribute="top" secondItem="QQO-QE-UpB" secondAttribute="bottom" id="w47-qC-B6j"/>
Expand All @@ -122,21 +135,33 @@
<exclude reference="I5s-Er-1u6"/>
</mask>
<mask key="constraints">
<exclude reference="7YR-p4-IaP"/>
<exclude reference="bpk-AS-OO4"/>
<exclude reference="w47-qC-B6j"/>
<exclude reference="FmS-Lj-6pH"/>
<exclude reference="JFK-rp-eX4"/>
<exclude reference="PBj-nY-3b0"/>
<exclude reference="c7R-F9-4WS"/>
<exclude reference="dbK-ZS-pQb"/>
<exclude reference="gHi-rw-64L"/>
<exclude reference="pOV-x6-5ye"/>
<exclude reference="tFs-ag-Lhh"/>
<exclude reference="wPG-sN-prQ"/>
<exclude reference="xCd-GB-vqf"/>
<exclude reference="7YR-p4-IaP"/>
<exclude reference="bpk-AS-OO4"/>
<exclude reference="w47-qC-B6j"/>
<exclude reference="kUV-Fh-4eg"/>
<exclude reference="vKM-q3-pRK"/>
<exclude reference="ye2-Dt-hIR"/>
<exclude reference="2Sy-at-XIM"/>
<exclude reference="Zq3-Xj-4d9"/>
<exclude reference="oaN-tT-Wel"/>
<exclude reference="kUV-Fh-4eg"/>
<exclude reference="vKM-q3-pRK"/>
<exclude reference="ye2-Dt-hIR"/>
</mask>
</variation>
<variation key="heightClass=compact">
<mask key="constraints">
<include reference="FmS-Lj-6pH"/>
<include reference="PBj-nY-3b0"/>
<include reference="c7R-F9-4WS"/>
<include reference="pOV-x6-5ye"/>
</mask>
</variation>
<variation key="widthClass=compact">
Expand All @@ -145,21 +170,21 @@
<include reference="I5s-Er-1u6"/>
</mask>
<mask key="constraints">
<include reference="7YR-p4-IaP"/>
<include reference="bpk-AS-OO4"/>
<include reference="w47-qC-B6j"/>
<include reference="JFK-rp-eX4"/>
<exclude reference="dbK-ZS-pQb"/>
<exclude reference="gHi-rw-64L"/>
<exclude reference="tFs-ag-Lhh"/>
<include reference="wPG-sN-prQ"/>
<include reference="xCd-GB-vqf"/>
<include reference="7YR-p4-IaP"/>
<include reference="bpk-AS-OO4"/>
<include reference="w47-qC-B6j"/>
<include reference="kUV-Fh-4eg"/>
<include reference="vKM-q3-pRK"/>
<include reference="ye2-Dt-hIR"/>
<exclude reference="2Sy-at-XIM"/>
<include reference="Zq3-Xj-4d9"/>
<exclude reference="oaN-tT-Wel"/>
<include reference="kUV-Fh-4eg"/>
<include reference="vKM-q3-pRK"/>
<include reference="ye2-Dt-hIR"/>
</mask>
</variation>
</view>
Expand Down
24 changes: 23 additions & 1 deletion ScrollPager/Source/ScrollPager.swift
Expand Up @@ -5,6 +5,26 @@
// Created by Aryan Ghassemi on 2/22/15.
// Copyright (c) 2015 Aryan Ghassemi. All rights reserved.
//
//
// https://github.com/aryaxt/ScrollPager
//
// 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.

import UIKit

Expand Down Expand Up @@ -83,6 +103,8 @@ import UIKit
}
}

@IBInspectable public var animationDuration: CGFloat = 0.2

// MARK: - Initializarion -

public required init(coder aDecoder: NSCoder) {
Expand Down Expand Up @@ -186,7 +208,7 @@ import UIKit
private func moveToIndex(index: Int, animated: Bool, moveScrollView: Bool) {
animationInProgress = true

UIView.animateWithDuration(0.2, delay: 0.0, options: .CurveEaseOut, animations: { [weak self] in
UIView.animateWithDuration(NSTimeInterval(animationDuration), delay: 0.0, options: .CurveEaseOut, animations: { [weak self] in

let width = self!.frame.size.width / CGFloat(self!.buttons.count)
let button = self!.buttons[index]
Expand Down
Binary file added scrollPager.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit 608ee42

Please sign in to comment.