Latest 1.0.0
Homepage https://github.com/gspd-mobi/SegmentedBarView-iOS
License MIT
Platforms ios 8.0, requires ARC
Frameworks UIKit, Foundation
Authors

Version
License
Platform

Screenshots

Imgur
Imgur

Usage

Constructor and setters

GSPDSegmentedBarView *segmentedBarView = [[GSPDSegmentedBarView alloc] init];
segmentedBarView.unit = attributedUnit;
segmentedBarView.segments = segmentedBarViewSegments;
segmentedBarView.value = value;
GSPDSegmentedBarView *segmentedBarView = [[GSPDSegmentedBarView alloc] initWithValue:@(1.0) unit:nil segments:segments];

Also you can use it with xibs and storyboards.

Create segments

In any case you should create segments list to put in view.

GSPDSegmentedBarSegment *segment1 = [[GSPDSegmentedBarSegment alloc] initWithMinValue:@(0.1) maxValue:@(1) color:[UIColor colorWithRed:0.94 green:0.24 blue:0.18 alpha:1]];
    segment1.segmentDescription = @"Segment 1";
    segment1.sideTextStyle = GSPDSegmentedBarSegmentSideTextStyleOneSided;
    GSPDSegmentedBarSegment *segment2 = [[GSPDSegmentedBarSegment alloc] initWithMinValue:@(1.1) maxValue:@(2.1) color:[UIColor colorWithRed:0.55 green:0.78 blue:0.24 alpha:1]];
    segment2.segmentDescription = @"Segment 2";
    GSPDSegmentedBarSegment *segment3 = [[GSPDSegmentedBarSegment alloc] initWithMinValue:@(2.1) maxValue:@(3.1) color:[UIColor colorWithRed:0.94 green:0.24 blue:0.18 alpha:1]];
    segment3.segmentDescription = @"Segment 3";
    segment3.sideTextStyle = GSPDSegmentedBarSegmentSideTextStyleOneSided;

segmentedBarView.segments = @[segment1, segment2, segment3];

Each segment contains min and max value, color, description text (optional), custom text (optional). Value sign position is calculated automatically in these intervals.

Also there can be segments with no min and max. Then you should set valueSegmentIndex field of SegmentedBarView, it’s just an index of segment to show value sign over.

Installation

GSPDSegmentedBarView is available through CocoaPods. To install
it, simply add the following line to your Podfile:

pod "GSPDSegmentedBarView"

Author

Alexander Kiyaykin, GSPD, [email protected]

License

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

Latest podspec

{
    "name": "GSPDSegmentedBarView",
    "version": "1.0.0",
    "summary": "Custom UI control for iOS which is showing data as a segments and a value inside them.",
    "description": "Customizable UI control for iOS which is showing data as a segments and a value inside them.",
    "homepage": "https://github.com/gspd-mobi/SegmentedBarView-iOS",
    "screenshots": [
        "http://i.imgur.com/iEq1unf.png",
        "http://i.imgur.com/nUbng0l.png"
    ],
    "license": "MIT",
    "authors": {
        "Alexander Kiyaykin": "[email protected]"
    },
    "source": {
        "git": "https://github.com/gspd-mobi/SegmentedBarView-iOS.git",
        "tag": "1.0.0"
    },
    "platforms": {
        "ios": "8.0"
    },
    "requires_arc": true,
    "source_files": "Pod/Classes/**/*",
    "resource_bundles": {
        "GSPDSegmentedBarView": [
            "Pod/Assets/*.png"
        ]
    },
    "frameworks": [
        "UIKit",
        "Foundation"
    ]
}

Pin It on Pinterest

Share This