i want to use a segmented control instead of a UITabBar controller to change the view. Is that in accordance with the HIG?
If yes, how can I do so? What template should I use for my project and what code?
There are several Apple apps that use a segmented control to change the view: iTunes, the App Store app and the YouTube app. However, they all use it at the top of the screen, and in conjunction with a segmented control. The Maps app uses one at the bottom of the screen, but the idea is different from a tab bar. The Calendar app also uses one, for List, Day and Month views (in the toolbar at the bottom).
I think the rule of thumb is that if you're providing different views of the same kind of data, you can use a segmented control. If the things that you're displaying are unrelated, you should use a tab bar. You probably wouldn't have an app rejected for using a segmented control, but users would be a bit confused if you used it in a non-standard way.
I'm not sure about sample code, the closest one I could see is the "Top Songs" sample. That doesn't swap views, it just changes the FetchedResultsController
when the segment is clicked on.
Here's another question on SO that's pretty much the same: