Skip to content

自定义UITableView索引条(A UITableView index bar that allows users to customize styles)

License

Notifications You must be signed in to change notification settings

beichenglangzi/TTIndexBar

 
 

Repository files navigation

TTIndexBar

Version License Platform

TTIndexBar is a UITableView index bar that allows users to customize styles.

Example

1、When you clicking the index bar:

2、When you sliding tableView:

3、When you sliding on the index bar:

Installation

TTIndexBar is available through CocoaPods. To install it, simply add the following line to your Podfile:

pod 'TTIndexBar'

Requirements

iOS 9.0+

How to use

Default:

self.indexBar = [[TTIndexBar alloc] initWithFrame:CGRectMake(self.view.frame.size.width - 30, 0, 30, self.view.frame.size.height)];
self.indexBar.delegate = self;
[self.view addSubview:self.indexBar];
    
[self.indexBar setIndexes:[NSMutableArray arrayWithObjects:@"A",@"B",@"C",@"D",@"E",@"F",@"G",@"H",@"I",@"J", nil]];

Custom style:

self.indexBar = [[TTIndexBar alloc] initWithFrame:CGRectMake(self.view.frame.size.width - 30, 0, 30, self.view.frame.size.height)];
self.indexBar.delegate = self;
[self.view addSubview:self.indexBar];   

//Custom property
self.indexBar.textColor = [UIColor redColor];
self.indexBar.selectedTextColor = [UIColor greenColor];
self.indexBar.selectedBackgroundColor = [UIColor yellowColor];
self.indexBar.detailViewDrawColor = [UIColor cyanColor];
self.indexBar.detailViewTextColor = [UIColor orangeColor];

[self.indexBar setIndexes:[NSMutableArray arrayWithObjects:@"A",@"B",@"C",@"D",@"E",@"F",@"G",@"H",@"I",@"J", nil]];

Delegate callback:

- (void)indexDidChanged:(TTIndexBar *)indexBar index:(NSInteger)index title:(NSString *)title;

Author

zhouting, [email protected]

License

TTIndexBar is available under the MIT license. See the LICENSE file for more info.

About

自定义UITableView索引条(A UITableView index bar that allows users to customize styles)

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • Objective-C 87.4%
  • Ruby 12.6%