RFSegmentView 是一个仿照 iOS7 风格的分段控制器,简洁,实用。
加入RFSegmentView.h/m文件即可使用
float init_y = 0; for (int i=0; i<10; i++) { RFSegmentView* segmentView = [[RFSegmentView alloc] initWithFrame:CGRectMake(0, 10+init_y, kScreenWidth, 60) items:@[@"spring",@"summer",@"autumn",@"winnter"]]; segmentView.tintColor = [self getRandomColor]; segmentView.delegate = self; [self.view addSubview:segmentView]; init_y +=60; } delegate: - (void)segmentViewSelectIndex:(NSInteger)index { NSLog(@"current index is %d",index); }