views:

289

answers:

1

I was wondering what the best approach in order to have a UISegmentedControl appears just under the a navigationController just like in the AppStore application.

AppStore example: http://img.skitch.com/20100420-fmyefsw4xxmqc7fq8k8j6whexq.jpg

The content I what to put in the different views are UITableView just like the AppStore app.

What I was thinking so far was:

  • a viewController with the UIToolbar with UISegmentedController
  • in this ViewController attaching my UITableViews

But what I can't figure out, is how to structure my controller source code files.

Do you have best practice, working examples or at least advices?

Thanks, Jérémy

A: 

I would use UITableView's tableHeaderView property for that. That way it will scroll together with the table view's contents.

To prevent the bar from scrolling together with the table content, I would make it a sibling view (relative to UITableView) and place it just above the table view. If you choose this approach you will have the following view hierarchy: controller's view holds the toolbar and the table view. Note that you will have to set up the table view and handle row deselection in -viewWillAppear: yourself, duplicating functionality of UITableViewController.

Costique
I just gave it a try, but as soon as you scroll the tableView down, the toolbar disappears, and this is not the behaviour I want.I really would like to have the toolbar always visible.
jchatard
Sorry, I didn't realize you want the bar to remain static. I updated my answer.
Costique