Scrolling problem with UITableView - iphone

!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

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.

Uisegmentedbar fixed above uitableview

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.

How do I create a view with a picker on the bottom and a table view on the top?

first time asker, long-time lurker.
I am trying to create an iPhone view that has a date/time picker on the bottom half of the screen, and a grouped, single-section, four-row table view on the top half of the screen (almost identical to the one Apple shows in Fig. 2-4 of their View Controller Programming Guide (but then never goes on to explain).
Conceptually, I think I understand that what I need is a main view with a pair of subviews - one for the picker, and one for the table view. I'm pretty sure I can make the picker function once I have it on-screen, and I'm pretty sure I can make the table view function too. What I can't for the life of me figure out is how, programmatically speaking, to get the two views onto the screen simultaneously. I can lay it out perfectly in Interface Builder, but then it all goes to hell when I switch to Xcode...the view appears with the picker, but no table view.
Thanks, in advance, for any help you can offer.
the view appears with the picker, but no table view.
If the table view isn't assigned a data source, then it has nowhere from which to populate itself, and so it may give you the appearance of "not being there".
Have you created a view controller for this view? Is it a subclass of UITableViewController, or does it at least implement the UITableViewDelegate/UITableViewDataSource protocols? Is it set as the File's Owner in the .xib? And has it been assigned (using the connections) as your table view's delegate and dataSource?
In your .xib, are both the UITableView and the UIPickerView subviews of a top-level UIView, which is connected to your view controller's view property (i.e. for the File's Owner)?
UIView
+
|
+---UITableView
|
+---UIPickerView

UIView in navigation controller goes upwards...?

i have attached as header one UIView(which has lot of buttons etc) in UITableViewController.i did not use table header.but when i scroll table view ,the header view (XIB file) goes upwards..can i stop it?
Don't create it inside the UITableViewController. Create it outside and then you should get the desired behavior.

UITableView - how to make search bar scroll with table

How can I make the search bar to scroll together with the table view? When I scroll my table view I want my search bar to go with it and disappear. I want to have done something similar to contacts app on the iPhone.
You can place your searchbar in the tableView's header row. This will make it part of the tableView.
Set up an empty table section, above or ahead of all other sections in your table view. Set this section's header to be your search bar view.