How can I replace a UITableViewController with a UIViewController that contains a UITableView?

Posted by Dr Dork on Stack Overflow See other posts from Stack Overflow or by Dr Dork
Published on 2010-05-13T19:54:42Z Indexed on 2010/05/13 20:04 UTC
Read the original article Hit count: 216

Filed under:
|
|

I created a new SplitView iPad project in Xcode and setup the code to populate the TableView (in the RootView on the left) with data. Now I'd like to customize the RootView to contain a DatePicker view along with the TableView, but I'm unsure how to accomplish this. Since the default RootViewController is a subclass of a UITableViewController, I couldn't add a DatePicker view to it in IB (since you can't add a DatePicker to a UITableView). The only way I understand to accomplish my goal of adding a DatePicker to the "Left" RootView is to change the RootViewController from a subclass of a UITableViewController to a subclass of a UIViewController, then I'll be able to add a view to it that contains a DatePicker view and a TableView using IB. Questions...

  1. Is this the correct approach to add a DatePicker to the "Left" RootView?
  2. If so and I change the RootViewController to a subclass of a UIViewController (instead of a UITableViewController) and add to it a TableView (along with the DatePicker), how will that affect the code I currently have in place for populating my current TableView?

Thanks so much for all your help! Below is my current interface code for my RootViewController, if it'll help any.

@interface RootViewController : UITableViewController <NSFetchedResultsControllerDelegate> {

    DetailViewController *detailViewController;

    NSFetchedResultsController *fetchedResultsController;
    NSManagedObjectContext *managedObjectContext;
}

@property (nonatomic, retain) IBOutlet DetailViewController *detailViewController;    
@property (nonatomic, retain) NSFetchedResultsController *fetchedResultsController;
@property (nonatomic, retain) NSManagedObjectContext *managedObjectContext;

- (void)insertNewObject:(id)sender;

@end

© Stack Overflow or respective owner

Related posts about ipad

Related posts about ipad-splitview