ETSegmentedView 0.2.2

ETSegmentedView 0.2.2

TestsTested
LangLanguage Obj-CObjective C
License MIT
ReleasedLast Release Sep 2015

Maintained by Ersen Tekin.




ETSegmentedView is a lightweight and synchronous custom segmented view for iOS platform. It's an easy-to-setup and fully customizable component.

Dependencies

ETSegmentedView depends on the POP animation framework by facebook.

Manually from Github

  1. Download source files from subdirectory
  2. Add the source files to your Xcode project.
  3. Import the ETSegmentedView.h header file.

Usage

To run the example project, clone the repo, and run from the Example directory first.

Here's the sample code to add ETSegmentedView to your any UIViewController or UIView

1. Initialize and customize the view

ETSegmentedView* sv = [[ETSegmentedView alloc] 
    initWithFrame:CGRectMake(10, 60, [[UIScreen mainScreen] bounds].size.width - 20, 260)];
sv.nonSelectionColor = [UIColor whiteColor];
sv.selectionColor = [UIColor darkGrayColor];

2. Set titles

[sv setTitles:@[@"Label", @"Image", @"WebView", @"Custom"]];

3. Set contents

UILabel* label = [[UILabel alloc] initWithFrame:CGRectMake(0, 0, 70, 40)];

UIImageView* imageView = [UIImageView alloc] initWithImage:[UIImage imageNamed:@"photo.png"];

// you can access segmentedView's button container view height with : "sv.viewButtons"
UIWebView* webView = [[UIWebView alloc] initWithFrame:CGRectMake(0, 0, sv.frame.size.width, sv.frame.size.height - sv.viewButtons.frame.size.height)];

UIView* customView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 100, 50)];

[arrayContents addObjectsFromArray:@[label, imageView, webView, customView]];
[sv setContents:arrayContents];

// if you are adding component to UIViewController
[self.view addSubview:sv];

Cheers! 🍻

License

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