That vertical scrubber for UITableViews

I seem to almost always forget what the magic sauce is for producing that indexed scrubber on the right side for a grouped table in iOS. Google is pretty good for most things iOS, but for this particular thing it comes up short unless you remember exactly what it is you are looking for. Defeating the purpose of the search in my estimation.

Anyway, I am posting this here mainly as a reference to myself, but also to others who may need to use this functionality but didn’t know exactly how it’s done, etc. I am only posting the magic method.

- (NSArray *)sectionIndexTitlesForTableView:(UITableView *)tableView {
	//This of course can be whatever array you need to pass back
	//even for different table views, etc.
	NSArray *arrIndexes = [NSArray arrayWithArray:
				     	[@"A,B,C,D,E,F,G,H,I,J,K,L,M,N,O,P,Q,R,S,T,U,V,W,X,Y,Z,#"
					    componentsSeparatedByString:@","]];
	return arrIndexes;
}
Related Posts Plugin for WordPress, Blogger...

Leave a Reply

Your email address will not be published. Required fields are marked *


4 × four =

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>