CocoaPods trunk is moving to be read-only. Read more on the blog, there are 18 months to go.

RFSegmentView 1.3.2

RFSegmentView 1.3.2

Maintained by wangruofeng.



  • By
  • wangruofeng

iOS RFSegmentView

Imitate after iOS7 style segmented controls! It is simple, Elegant, practical!

Requirements

iOS8.0 and later

Usage

install via source code

  1. download the newest code , and #import "RFSegmentView.h"
  2. use blow method to initialize
 - (instancetype)initWithFrame:(CGRect)frame titles:(NSArray<NSString *> *)titles; 
  1. set TintColor and delegate or block handler if needed
  2. implement delegate callBack function if you use delegate
- (void)segmentView:(RFSegmentView * __nullable)segmentView didSelectedIndex:(NSUInteger)selectedIndex;

or use block callback

segmentView.handlder = ^ (RFSegmentView * __nullable view, NSUInteger selectedIndex) {
	// doSomething
};

install via CocoaPod

first add to config to Podfile

pod 'RFSegmentView', '~>1.3.0'

then import header file and enjoy it.

#import <RFSegmentView.h>

below is sample code

  RFSegmentView* segmentView = [[RFSegmentView alloc] initWithFrame:aRect titles:@[@"spring",@"summer",@"autumn",@"winnter"]];
  segmentView.tintColor       = aColor;
  //segmentView.delegate      = self;
  segmentView.handlder = ^ (RFSegmentView * __nullable view, NSUInteger selectedIndex) {
          // doSomething
  };
  [self.view addSubview:segmentView];

Ps:you can also use delegate callback.

Screenshot

Download

You can download binary release from the latest releases.

License

RFSegmentView is released under the MIT license. See LICENSE for details.