Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

iLoveDeveloping

Suspended
Original poster
Sep 24, 2009
596
2,366
Ireland
Hey,

Just have a quick question, I have a new app made with "Navigation Based Application", but i would like to put a new View in the beginning when it starts!
So it launches, First screen - View - then press a button and it goes to - The Nav Screen - or back again..

Now its my understanding you can change the way the App launches with the
Code:
- (void)applicationDidFinishLaunching:(UIApplication *)application {

Am i right or wrong? But everything i try seems to still launch the App with the Nav screen not the View i made.. This is the code i have in the App... Any help?

Code:
#import "TestAppDelegate.h"
#import "TestViewController.h"
#import "RootViewController.h"


@implementation TestAppDelegate

@synthesize viewController;
@synthesize window;
@synthesize navigationController;


#pragma mark -
#pragma mark Application lifecycle

- (void)applicationDidFinishLaunching:(UIApplication *)application {    
	[window addSubview:viewController.view];
        [window makeKeyAndVisible];
    // Override point for customization after app launch    

	[window addSubview:[navigationController view]];
	[window makeKeyAndVisible];

}


- (void)applicationWillTerminate:(UIApplication *)application {
	// Save data if appropriate
}


#pragma mark -
#pragma mark Memory management

- (void)dealloc {
    [viewController release];
	[navigationController release];
	[window release];
	[super dealloc];
}

@end

Thanks!
 
Is viewController for this new view? If so, you are adding it's view as a subview and then going ahead and adding the navigationController's view right over top of it.

Here's what I suggest you do: use presentModalViewController: with your viewController after having added navigationController's view.
 
Is viewController for this new view? If so, you are adding it's view as a subview and then going ahead and adding the navigationController's view right over top of it.

Here's what I suggest you do: use presentModalViewController: with your viewController after having added navigationController's view.

Yes viewController is the new View.

Oh i see, didn't even notice i was doing that... Ok i will have a try.
 
ok, very newbie help needed here... (i am sorry! :eek:) Where do i put the code?

Code:
presentModalViewController:viewController

I put it in the AppDelegate and it terminated due to an uncaught exception..

I need a 'method signature' i think, does that go in the .h Delegate? what would that be?
 
ok, very newbie help needed here... (i am sorry! :eek:) Where do i put the code?
Reread my post, especially the last five words of it.

Code:
presentModalViewController:viewController
Sorry, that's not how you call it. Please read the UIViewController documentation for the proper usage of presentModalViewController:animated:. For one, it's an instance method, which means you need to call it on an instance of UIViewController.

Are you sure you understand the basics of Objective-C enough to continue with the real coding?
 
Reread my post, especially the last five words of it.


Sorry, that's not how you call it. Please read the UIViewController documentation for the proper usage of presentModalViewController:animated:. For one, it's an instance method, which means you need to call it on an instance of UIViewController.

Are you sure you understand the basics of Objective-C enough to continue with the real coding?

No i don't really understand where to put it to be honest! I read the documentation but still don't no what to put where? I always just either used View controllers or nav views, never both, so i don't really have any experience on putting one into the other..

Any help anyone could give me would be very appreciated, i am still learning very slowly... :eek:
 
That help?

Oh i know where to put it, i don't know however what to put, everything i try i just get a new error...
Code:
	// Override point for customization after app launch    
		[window addSubview:[navigationController view]];
		[window makeKeyAndVisible];
		// This is after
		presentModalViewController:(viewController *) animated:YES;
	}

closest i got so far... :confused:



Or do i put the full line:

Code:
- (void)presentModalViewController:(UIViewController *)modalViewController animated:(BOOL)animated
But still get an error
 
Yes. Sorry but it's pretty obvious you have no clue how to properly call an instance method. Leave the real code alone and go learn Objective-C.

If you don't want to help me anymore then giving me a link then that's fine, i am simply asking for help cos i DO NOT KNOW what to do with that information...

If you told me how to do it then you would have thought me and i would then never have to ask how to call an instance method again cos i could do it from then on, itsn't that how people learn?!

Whats the difference between someone telling me and learning how to do it from that or looking in a book and learning that way... Both the same to me..

Just asking for help thats all...


So can anyone give me more information?
 
I agree with dejo, you really need to understand the programming language before starting developing your application.
What's kinda scary is that besides iChocolate (the app that ILoveDeveloping links to in his profile), he has 10 other apps on the App Store. All without knowing how to construct an instance method call.

I recommend this Objective-C manual from Apple.
Another good resource. Can seem a little daunting when you first are learning Objective-C but once you're more comfortable with things, rereads are easier.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.