https://github.com/globakmaxim/gmsegmentedcontrol
https://github.com/globakmaxim/gmsegmentedcontrol
objective-c uisegmentedcontrol
Last synced: about 1 year ago
JSON representation
- Host: GitHub
- URL: https://github.com/globakmaxim/gmsegmentedcontrol
- Owner: GlobakMaxim
- License: other
- Created: 2017-04-08T20:47:25.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2017-09-25T15:43:04.000Z (almost 9 years ago)
- Last Synced: 2025-04-28T10:21:31.103Z (about 1 year ago)
- Topics: objective-c, uisegmentedcontrol
- Language: Objective-C
- Size: 227 KB
- Stars: 5
- Watchers: 1
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE.md
Awesome Lists containing this project
README
# GMSegmentedControl
* Customization
* Swipeable
* Nullable (Able to deselect segment)

## Installation
Cocoapods
```
pod 'GMSegmentedControl'
```
## Usage
```objective-c
NSArray *segments = @[@"First", @"Second", @"Third"];
GMSegmentedControl *segmentedControl = [[GMSegmentedControl alloc] initWithSegments:segments];
segmentedControl.frame = CGRectMake(0, 0, 300, 40);
segmentedControl.center = self.view.center;
segmentedControl.cornerType = GMSegmentedControlCornerTypePill;
[segmentedControl addTarget:self action:@selector(segmentedControlValueChanged:) forControlEvents:UIControlEventValueChanged];
[self.view addSubview:segmentedControl];
```
## Default settings
```objective-c
self.clipsToBounds = YES;
self.selectedSegmentIndex = NSNotFound;
self.cornerType = GMSegmentedControlCornerTypeDefault;
self.backgroundColor = [UIColor blueColor];
self.tintColor = [UIColor whiteColor];
self.thumbTextColor = [UIColor darkGrayColor];
self.animationDuration = 0.1;
self.enableDeselecting = YES;
```
## Corner radius
```objective-c
typedef NS_ENUM(NSInteger, GMSegmentedControlCornerType) {
GMSegmentedControlCornerTypeDefault, // cornerRadius = 0
GMSegmentedControlCornerTypeRounded1, // cornerRadius = 4
GMSegmentedControlCornerTypeRounded2, // cornerRadius = 8
GMSegmentedControlCornerTypePill, // cornerRadius = half height
};
```
* GMSegmentedControlCornerTypeDefault

* GMSegmentedControlCornerTypeRounded1

* GMSegmentedControlCornerTypeRounded2

* GMSegmentedControlCornerTypePill

## License
GMSegmentedControl is licensed under the terms of the MIT License. Please see the [LICENSE](./LICENSE.md) file for full details.