I played with the iPad SplitView template in Xcode. Here are two of the many important methods that are automatically generated for you using the Split View-based application template ...
AppNameAppDelegate.m
#pragma mark - #pragma mark Application lifecycle - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
RootViewController.m
#pragma mark - #pragma mark View lifecycle - (void)viewDidLoad { [super viewDidLoad]; self.clearsSelectionOnViewWillAppear = NO; self.contentSizeForViewInPopover = CGSizeMake(320.0, 600.0); NSError *error = nil; if (![[self fetchedResultsController] performFetch:&error]) { NSLog(@"Unresolved error %@, %@", error, [error userInfo]); abort(); } }
When you create and run a project before any changes, the application:didFinishLaunchingWithOptions is called before the RootViewController:viewDidLoad method RootViewController:viewDidLoad . I am new to iPhone development, but I guess this is the correct and typical sequence. So, here are the changes I made ...
- As soon as I confirmed that everything works without any changes, I changed the RootViewController code and set it as a subclass of the
UIViewController (instead of the default UITableViewController ) and made the appropriate settings in Interface Builder. I built and ran, everything was fine. - Then I added a UIView (without anything) to the RootView in IB, and when I built and started it, suddenly
RootViewController:viewDidLoad is called before the application:didFinishLaunchingWithOptions .
I need to get it back to the way it worked before, because as you can see in the code, the viewDidLoad method depends on the didFinishLauchingWithOptions method, so it can set the rootViewController managedObjectContext that it uses to perform the selection.
- Any ideas what caused this?
- Any ideas how I can fix this?
Thank you for your help! I will continue to study and play with the code.
BeachRunnerFred
source share