How to replace a UITableViewController with a UIViewController that contains a UITableView?

I created a new iPad SplitView project in Xcode and set the code to populate the TableView (in the RootView on the left) with data. Now I would like to configure the RootView to contain the DatePicker view along with the TableView, but I'm not sure how to do this. Since the RootViewController is by default a subclass of UITableViewController, I could not add the DatePicker view to it in IB (since you cannot add the DatePicker to the UITableView). The only way to figure out how to add a DatePicker to the “Left” RootView is to change the RootViewController from a subclass of UITableViewController to a subclass of UIViewController, then I can add a view to it that contains the DatePicker and TableView using IB. Questions ...

  • Is this the right approach to add a DatePicker to the "Left" RootView?
  • If so, and I change the RootViewController to a subclass of UIViewController (instead of the UITableViewController) and add a TableView to it (along with the DatePicker), how will this affect the code I currently have to populate my current TableView?

Many thanks for your help! Below is my current interface code for my RootViewController if this helps anyone.

@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
+3
source share
1 answer

, , UITableViewController, , RootViewController UIViewController, UITableView * tableView , , , , UITAbleView nib UIView , tableView ( , , )... , , UITableView ( UITableViewCOntroller ), , , .

+4

Source: https://habr.com/ru/post/1745340/


All Articles