Uisegmentedbar fixed above uitableview - iphone

I have a UITableViewController subclass and it appears in a navigation stack however I want to add a view (uisegmentedcontrol) to above the tableview like in the AppStore when you go into categories and drill down un a list of apps there is a segmented control with paid free and grossing. If you scroll the tableview it stays attached to the navbar. Unlike adding a view to the table header which means it scrolls with the content which is not what I want.

Your best option is to create a UIViewController, then add a UISegmentedControl then a UITableView.

Related

How can I "enable" scrolling up and down in a UIViewController

Ok, I have a navigation Controller that manages a drilldown tableview, when it reaches to the end it show a list of products, when you choose a product it will show a detail view (UiViewController).
What I want to know is how to "Enable" scrolling up and down in that detail view so i can show full information about the product to the user.
Thanks
Got the answer. If you are using Storyboards (like myself) you have to go to the attributes inspector of the UiViewController and change the size parameter to freeform, then select the UIView of the UIViewController and in the size inspector choose whatever width or height you want and finally grab the Scroll View from the object library and insert it.
You need to add an UIScrollView to the view controller's view, and set its contentSize.

Use UINavigationController or ContentController?

I am a Apple developer that used to work with UIImages and photography. Now I am entering int the Table/List problems and having some trouble.
I need to implement a system that shows up a lot of views, separated by contexts (see the UITabBarItems below). One of this views is a list of places, separated by categories. Every list has its banner.
I tried to put on my main window a tabbarcontroller that includes 3 viewcontrollers and the one that shows the categories . It's a navigationcontroller. The problem is: I can't control the ads this way!
Does someone know what can i do?
SEE MY MOCKUP
In short, I want to allow to put an image over a UINavigationController, like this:
what i want to do
If you create and use a subclass of UINavigationController you can add a custom ad as a subview.
Then, you can set the height of the tableview footer to be the same height as your ad if your ad is over the tableview, so the tableview ends at the top of the ad.
This is how I have ads via the MobClix framework set up in an app.
One option is to add it as a subview to your subclass of UITableViewController. If the ad is different depending on the category you could pass it on before pushing another view controller into the navigation stack. Or you could use a delegate pattern to ask the parent view controller what ad it should be displaying.
A better option which takes more effort, is to actually use a subclass of UIViewController which implements UITableViewDataSource and UITableViewDelegate protocols and put a tableview inside it. Now you can resize your tableview to accommodate the ad banner. That way you can avoid some items remaining hidden behind your banner.

iOS Navigation bar

I want to build an application with this kind of navigation between views:
a scrollview with text items (like a menu bar). Check Radio-Canada app on app store (free).
How to proceed? I know that I need a scrollview, but after that... You have to understand that I don't have too much experience with iOS 5.
Check this snapshot for an example:
snap http://www.eazyrf.com/Snap2.jpg
For a horizontal scrollview, just create a scrollview and add buttons to it. The white 'selected' background you clipped can be created by loading a white oval and using resizeableImageWithCapInsets: to extend it to fit the text. Link the button's click event to a function that presents the new view. If this 'menu bar' acts like a standard iOS tab bar, you'll need to manage the view hierarchy yourself.
For a vertical scrollview, most likely you're looking at a UITableView contained within a UINavigationController, where the class implementing UITableViewDelegate for the table view is responding to didSelectRowAtIndexPath by pushing a new view onto the navigation controller. This is a common pattern to implement what looks like a scrolling list of items, where tapping on one cell causes a transition to a new screen.

Scrolling problem with UITableView

!I have a UITableviewController with a navigation bar as header. there are 4 sections in the table, Number of rows in the table are more than that can be fit in the iphone screen. while scrolling whole view is getting scrolled!!. I want the header to be stationary and only table to be moved.
Also the last section is appearing twice! like this.
Table view controller snapshot
please help
Thanks in advance
First don't use Navigation bar as the header of TableView. You should use a navigation controller and push this viewcontroller which contains tableview. This will allow you to get rid of first problem i.e. to keep the bar steady and not scroll with the tableview.
Second problem looks really weird, it seems to be that you have laid out two UITableView in your nib. Check again and remove one.
You have two options:
1) add a base UIView on which your header view and your table view are siblings.
2) set the header view as the table view's viewForHeader of the first section
You have only one option:
1)create a UIView lets say headerView and add control or whatever you
want to have and put that custom UIView on top of your UITableView
2)Do not implement viewForHeaderInsection
3)Change the y position of your UITableView to place your tableView
below your headerView

Iphone UiNavigation controller types

In examples I have seen of UINavigationContoller and UITableView, switching to next view is usually triggered by tapping into that cell and pushing a different UIViewController on top of stack, but what I want is to switch to next view by pressing a next button in bottom of page, which I want it to load the same UITableViewController again but with different contents in each cell.
-Can I put that next button on bottom of page? and where
-Can I call the same controller (but showing different contents) and put on top of stack using the UINavigationController?
Because I want to be able to browse back previos pages.
You would generally do as you highlighted first and push a new UIViewController subclass onto the UINavigationController.
A UIViewController is supposed to manage one screens worth of content. If you plan on breaking that convention by presenting different information you are essentially going to have duplicated if statements to decide whether the user should be viewing the content from before or after the button was tapped.
UINavigationController's are good for hierarchal data where the content becomes more specific as you drill down. The UINavigationController will also manage the stack so that you can go to previous pages.
To achieve what you want to achieve (stated here) you should be using a UINavigationController with your custom subclass of UITableViewController when the user submits questions you receive your xml, parse it and then instantiate a new instance of your UITableViewController subclass and push it onto the stack.
You can add a button in the footer view of your table view. To achieve this have a look at tableView:viewForFooterInSection:. Then add an action to that button which allocs and inits the view controller with the new content and pushes it onto the stack.
Just make your UITableViewDatasource returning your number of rows plus one in the last section you have in –(NSUInteger)tableView:numberOfRowsInSection:. Set any content for that cell before returning it to the tableView.
Then only push a new UIVIewController, when the user touches that last cell.
You could also make the delegate of the UITableView returning nil on :
-(NSIndexPath *)tableView:(UITableView *)tableView willSelectRowAtIndexPath:(NSIndexPath *)indexPath for the cells you don't want the user select.