Posted on 16 Aug 2022, this text provides information on Learning Aids/Tools related to General Tech. Please note that while accuracy is prioritized, the data presented might not be entirely correct or up-to-date. This information is offered for general knowledge and informational purposes only, and should not be considered as a substitute for professional advice.
I am using Apple's CoreDataBooks sample project as a learning aid for core data.
I modified the app so that when the app loads I show a menu page first - not the Books tableview (RootViewController).
I have done the following:
I created a menu page in interface builder (just a view with a button on it)
The CoreDataBooksAppDelegate.h now looks like this:
// for the menu@classMenuViewController;@interfaceCoreDataBooksAppDelegate:NSObject<UIApplicationDelegate>{NSManagedObjectModel*managedObjectModel;NSManagedObjectContext*managedObjectContext;NSPersistentStoreCoordinator*persistentStoreCoordinator;UIWindow*window;UINavigationController*navigationController;//for the menuMenuViewController*viewController;}-(IBAction)saveAction:sender;//for the menu@property(nonatomic, retain)IBOutletMenuViewController*viewController;@property(nonatomic, retain, readonly)NSManagedObjectModel*managedObjectModel;@property(nonatomic, retain, readonly)NSManagedObjectContext*managedObjectContext;@property(nonatomic, retain, readonly)NSPersistentStoreCoordinator*persistentStoreCoordinator;@property(nonatomic, readonly)NSString*applicationDocumentsDirectory;@property(nonatomic, retain)IBOutletUIWindow*window;@property(nonatomic, retain)IBOutletUINavigationController*navigationController;@end
The CoreDataBooksAppDelegate.m looks like this:
#import "CoreDataBooksAppDelegate.h"#import "RootViewController.h"// for the menu#import "MenuViewController.h"@implementationCoreDataBooksAppDelegate@synthesize window;@synthesize navigationController;// for the menu@synthesize viewController;#pragma mark -#pragma mark Application lifecycle
-(void)applicationDidFinishLaunching:(UIApplication*)application {RootViewController*rootViewController =(RootViewController*)[navigationController topViewController];
rootViewController.managedObjectContext = self.managedObjectContext;// for the menu[window addSubview:viewController.view];// Configure and show the window[window makeKeyAndVisible];}
The rest of CoreDataAppDelegete.m remains unchanged.
In the MenuViewController when the button is clicked, the following action takes place:
No matter what stage you're at in your education or career, TuteeHUB will help you reach the next level that
you're aiming for. Simply,Choose a subject/topic and get started in self-paced practice
sessions to improve your knowledge and scores.
manpreet
Best Answer
2 years ago
I am using Apple's CoreDataBooks sample project as a learning aid for core data.
I modified the app so that when the app loads I show a menu page first - not the Books tableview (RootViewController).
I have done the following:
I created a menu page in interface builder (just a view with a button on it)
The CoreDataBooksAppDelegate.h now looks like this:
The CoreDataBooksAppDelegate.m looks like this:
The rest of CoreDataAppDelegete.m remains unchanged.
In the MenuViewController when the button is clicked, the following action takes place: