iOS 自定义分段选择器


 

UIFont *titleFont = [UIFont systemFontOfSize:13];

// 状态1 

TKSegementedItemStatus *compositeNormal = [TKSegementedItemStatus statusWithTitle:@"综合" titleColor:[UIColor blackColor] titleFont:titleFont image:nil backgroundImage:nil becomeCurrentStatusBlock:^{
        NSLog(@"综合默认状态");
    }];

 

// 状态2

TKSegementedItemStatus *compositeSelected = [TKSegementedItemStatus statusWithTitle:@"综合" titleColor:[UIColor redColor] titleFont:titleFont image:nil backgroundImage:nil becomeCurrentStatusBlock:^{
        NSLog(@"综合刚刚被选中");
    }];

 

// 状态3

TKSegementedItemStatus *compositeOthers = [TKSegementedItemStatus statusWithTitle:@"综合" titleColor:[UIColor green] titleFont:titleFont image:nil backgroundImage:image3 becomeCurrentStatusBlock:^{
        NSLog(@"价格降序状态");
    }];

 

TKSegementedItem *compositeItem = [TKSegementedItem itemWithNormalStatus:compositeNormal selectedStatus:compositeSelected otherStatus:compositeOthers];

TKSegementedView *segementedView = [TKSegementedView segementedViewWithSegementedItem:compositeItem, volumeItem, priceItem, filterItem, nil];

 

segementedView.frame = CGRectMake(0, 64, self.view.bounds.size.width, 35);

segementedView.verticalDividerInset = UIEdgeInsetsMake(10, 0, 10, 0);

[self.view addSubview:segementedView];

 

https://github.com/tomatoK/TKSegementedView


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM