How to change UITableView

103 Views Asked by At

I'm using iPhoneCoreDataRecipes sample as as base code for my project and there is one thing that I was not able to modify. Also, I'm not quite sure if it is even possible.

I would like to modify the table that displays recipes (the first one). Right now the table gets the data from recipeListControllerand by default it covers the whole screen. I would like to change that. I still want to build a table with recipes data but I'm planning to shrink the table and modify its look. I guess table view controller is created in the mainWindow.xib. Normally when I'm creating tables, I'm inserting them into UIViewController in the interface builder and then I use UIViewController <UITableViewDelegate, UITableViewDataSource> in my class. Here are the bits that I think I need to modify:

   @interface RecipeListTableViewController : UITableViewController <RecipeAddDelegate,   NSFetchedResultsControllerDelegate> {

to something like this:

    @interface RecipeListTableViewController : UIViewController <RecipeAddDelegate, NSFetchedResultsControllerDelegate, UITableViewDelegate, UITableViewDataSource> {

and then after creating UIView Controller in MainWindow.xib I think I need to hook it up with recipeListController. Inside of this UIView, I want to have a custom table, which then should use recipe data. Unfortunately I get errors...

I would appreciate any suggestions. Here is the project that I used:

http://developer.apple.com/library/ios/#samplecode/iPhoneCoreDataRecipes/Introduction/Intro.html

1

There are 1 best solutions below

1
On BEST ANSWER

My suggestion : create a uiview below the table view, then put the table view as a subview of that view, and then you can manage its size as being not full screen. The underlying view is mapped to the RecipeListTableViewController.view outlet, you probably need to create another one for the table view (just to call [tableView reloadData] for example). The delegate and data source of the table view point as well to RecipeListTableViewController. By experience this will work.