Latest 0.1.1
Homepage https://github.com/rdgonzalez85/BTHorizontalPageableView
License MIT
Platforms ios 8.0, requires ARC

Horizontal pageable scroll view with tabs.
It uses YSSegmentedControl for the tab control.

Demo

Alt Text

Usage

Create BTHorizontalPageableView with titles, views and frame.

let view1 = UIView(frame:self.view.frame)
view1.backgroundColor = UIColor.redColor()

let view2 = UIView(frame:self.view.frame)
view2.backgroundColor = UIColor.yellowColor()

let view3 = UIView(frame:self.view.frame)
view3.backgroundColor = UIColor.grayColor()

let btScrollView = BTHorizontalPageableView(frame: self.view.frame)
btScrollView.views = [view1,view2,view3]
btScrollView.titles = ["1", "2", "3"]
self.view.addSubview(btScrollView)

Installation

**Embedded frameworks require a minimum deployment target of iOS 8

CocoaPods

CocoaPods is a dependency manager for Cocoa projects. You can install it with the following command:

$ gem install cocoapods

To integrate BTHorizontalPageableView into your Xcode project using CocoaPods, specify it in your Podfile:

source 'https://github.com/CocoaPods/Specs.git'
platform :ios, '8.0'
use_frameworks!

pod 'BTHorizontalPageableView'

Then, run the following command:

$ pod install

Manually

If you prefer you can integrate BTHorizontalPageableView into your project manually.

Configuration

public class BTHorizontalPageableView: UIView, YSSegmentedControlDelegate, UIScrollViewDelegate {

// The Segmented control, used for display the 'titles' bar.
var segmentedControl : YSSegmentedControl

// Indicates if the 'views' should be placed under the 'titles' bar.
var viewsUnderSegmentedControl : Bool

// Height of the segmented view.
var segmentedHeight : CGFLoat

// Y origin point of the segmented view.
var segmentedYOrigin : CGFLoat

// X origin point of the segmented view.
var segmentedXOrigin : CGFLoat

// The titles of the segments.
var titles : Array<String>

// The duration of the animation for scrolling to a new page.
var scrollViewPageChangeAnimationDuration : NSTimeInterval

// The container for the views.
var scrollView : UIScrollView

// The containing views.
var views : Array<UIView>
}

Control tab bar appearance

appearance = YSSegmentedControlAppearance(

backgroundColor: UIColor.clearColor(),
selectedBackgroundColor: UIColor.clearColor(),

textColor: UIColor.grayColor(),
font: UIFont.systemFontOfSize(15),

selectedTextColor: UIColor.blackColor(),
selectedFont: UIFont.systemFontOfSize(15),

bottomLineColor: UIColor.blackColor(),
selectorColor: UIColor.blackColor(),

bottomLineHeight: 0.5,
selectorHeight: 2)

You can change appearance by

segmented.appearance = YSSegmentedAppearance (...)

// or

segmented.appearance.titleColor = ...

Latest podspec

{
    "name": "BTHorizontalPageableView",
    "version": "0.1.1",
    "summary": "Horizontal pageable scroll view with tabs.",
    "platforms": {
        "ios": "8.0"
    },
    "description": "Add custom views and titles to generate a view linking views and titles.",
    "requires_arc": true,
    "license": {
        "type": "MIT",
        "file": "LICENSE"
    },
    "authors": "Rodrigo Gonzalez",
    "homepage": "https://github.com/rdgonzalez85/BTHorizontalPageableView",
    "source": {
        "git": "https://github.com/rdgonzalez85/BTHorizontalPageableView.git",
        "commit": "41f0cda28130ac8c72502d22c3ce21b91c1079e2",
        "tag": "0.1.1"
    },
    "source_files": "BTHorizontalPageableView/BTHorizontalPageableView/*.{swift}"
}

Pin It on Pinterest

Share This