Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/nealyoung/NYSegmentedControl
Animated, customizable replacement for UISegmentedControl
https://github.com/nealyoung/NYSegmentedControl
Last synced: 3 months ago
JSON representation
Animated, customizable replacement for UISegmentedControl
- Host: GitHub
- URL: https://github.com/nealyoung/NYSegmentedControl
- Owner: nealyoung
- License: mit
- Created: 2014-03-23T08:05:16.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2017-10-31T23:31:04.000Z (over 7 years ago)
- Last Synced: 2024-10-29T20:00:54.644Z (4 months ago)
- Language: Objective-C
- Homepage:
- Size: 4.4 MB
- Stars: 1,011
- Watchers: 30
- Forks: 125
- Open Issues: 19
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# NYSegmentedControl
NYSegmentedControl is a customizable, animated replacement for UISegmentedControl inspired by controls found in Instagram, Foursquare, and other apps.

### Features
* Create segmented controls with animated selection indicator
* Customize colors, gradients, fonts, etc. either directly or globally with UIAppearance
* Configure distinct text styles for the selected segment
* VoiceOver/accessibility support
### Installation
#### Manual
Add the files to your project manually by dragging the NYSegmentedControl directory into your Xcode project.#### CocoaPods
Add `pod 'NYSegmentedControl'` to your Podfile, and run `pod install`.### Usage
Use is largely identical to UISegmentedControl. An example project is included in the NYSegmentedControlDemo directory.```objc
// Import the class and create an NYSegmentedControl instance
#import "NYSegmentedControl.h"// ...
NYSegmentedControl *segmentedControl = [[NYSegmentedControl alloc] initWithItems:@[@"Segment 1", @"Segment 2"]];
// Add desired targets/actions
[segmentedControl addTarget:self action:@selector(segmentSelected) forControlEvents:UIControlEventValueChanged];// Customize and size the control
segmentedControl.borderWidth = 1.0f;
segmentedControl.borderColor = [UIColor colorWithWhite:0.15f alpha:1.0f];
segmentedControl.drawsGradientBackground = YES;
segmentedControl.segmentIndicatorInset = 2.0f;
segmentedControl.drawsSegmentIndicatorGradientBackground = YES;
segmentedControl.segmentIndicatorGradientTopColor = [UIColor colorWithRed:0.30 green:0.50 blue:0.88f alpha:1.0f];
segmentedControl.segmentIndicatorGradientBottomColor = [UIColor colorWithRed:0.20 green:0.35 blue:0.75f alpha:1.0f];
segmentedControl.segmentIndicatorAnimationDuration = 0.3f;
segmentedControl.segmentIndicatorBorderWidth = 0.0f;
[segmentedControl sizeToFit];// Add the control to your view
self.navigationItem.titleView = self.segmentedControl;
```### License
This project is released under the MIT License.