PDA

View Full Version : Nav. App Help




iLoveDeveloping
Dec 4, 2009, 08:51 AM
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 - (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?


#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!



dejo
Dec 4, 2009, 09:18 AM
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.

iLoveDeveloping
Dec 4, 2009, 10:12 AM
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.

iLoveDeveloping
Dec 4, 2009, 10:23 AM
ok, very newbie help needed here... (i am sorry! :o) Where do i put the 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?

dejo
Dec 4, 2009, 10:43 AM
ok, very newbie help needed here... (i am sorry! :o) Where do i put the code?
Reread my post, especially the last five words of it.

presentModalViewController:viewController
Sorry, that's not how you call it. Please read the UIViewController (http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html) 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?

iLoveDeveloping
Dec 4, 2009, 01:44 PM
Reread my post, especially the last five words of it.


Sorry, that's not how you call it. Please read the UIViewController (http://developer.apple.com/iphone/library/documentation/UIKit/Reference/UIViewController_Class/Reference/Reference.html) 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... :o

dejo
Dec 4, 2009, 03:20 PM
- (void)applicationDidFinishLaunching:(UIApplication *)application {
// Override point for customization after app launch
[window addSubview:[navigationController view]];
[window makeKeyAndVisible];
// This is after
}

That help?

iLoveDeveloping
Dec 4, 2009, 03:33 PM
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...

// 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:

- (void)presentModalViewController:(UIViewController *)modalViewController animated:(BOOL)animated But still get an error

dejo
Dec 4, 2009, 03:37 PM
...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.

iLoveDeveloping
Dec 4, 2009, 03:59 PM
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?

dejo
Dec 4, 2009, 04:08 PM
Just asking for help thats all...
It's hard to help those who don't help themselves.

So can anyone give me more information?Start here (http://forums.macrumors.com/showthread.php?t=518968), paying special attention to the link to Cocoa Dev Central.

bredell
Dec 4, 2009, 05:47 PM
So can anyone give me more information?

I agree with dejo, you really need to understand the programming language before starting developing your application. I recommend this (http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/ObjectiveC/ObjC.pdf) Objective-C manual from Apple.

dejo
Dec 4, 2009, 06:59 PM
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 (http://developer.apple.com/mac/library/documentation/Cocoa/Conceptual/ObjectiveC/ObjC.pdf) 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.