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.

Answers


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

Need Your Help

Custom Members and role database?

c# asp.net sql asp.net-membership

Newbie here, I havn't done much membership stuff for asp.net. I am trying to take advantage of the asp.net membership mechanism for a new app I am building, but I wish to store the member informati...

Dynamic image versions with carrierwave

ruby-on-rails ruby carrierwave

I have a list of sizes in the database and I need to resize my images to, and I use carrierwave to upload them.