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];