Scope Bar for UITableView like App Store?

Aloha Silver picture Aloha Silver · Jul 3, 2010 · Viewed 7.2k times · Source

Does anyone know how to add a scope bar to a UITableView? The App Store app does this sometimes, like in the picture below.

I would like to use this scope bar to add sorting options for the elements in the UITableView. This would be more convenient than having a toolbar with a UISegmentControl.

I just don't know how to implement this. I don't even know the name of the element (I'm calling it scope bar because it looks just like the scope bar of a UISearchBar, but it is not).

image showing what I want

Answer

kennytm picture kennytm · Jul 3, 2010

Actually, unlike what others have said, this UISegmentedControl's .segmentedControlStyle property is set to an undocumented value of 7.

 theSegCtrl.segmentedControlStyle = 7;

But @Macatomy's answer is more AppStore-safe (although Apple can't detect this anyway).