Reputation: 1105
I'm currently building a project using Three20 (v 1.0.4). It builds and runs with no errors or warnings. It's simply the AppDelegate and a TTLauncher class.
#import <Three20/Three20.h>
@interface AppDelegate : NSObject <UIApplicationDelegate>
{
}
@end
#import "AppDelegate.h"
#import "LauncherController.h"
@implementation AppDelegate
//=============================================================
// UIApplicationDelegate
- (void)applicationDidFinishLaunching:(UIApplication*)application
{
TTNavigator* navigator = [TTNavigator navigator];
navigator.persistenceMode = TTNavigatorPersistenceModeAll;
TTURLMap* map = navigator.URLMap;
[map from:@"*" toViewController:[TTWebController class]];
[map from:@"tt://launcher" toViewController:[LauncherController class]];
[navigator openURLAction:[TTURLAction actionWithURLPath:@"tt://launcher"]];
}
- (BOOL)application:(UIApplication*)application handleOpenURL:(NSURL*)URL
{
[[TTNavigator navigator] openURLAction:[TTURLAction actionWithURLPath:URL.absoluteString]];
return YES;
}
@end
#import <Three20/Three20.h>
@interface LauncherController : TTViewController <TTLauncherViewDelegate>
{
TTLauncherView* _launcherView;
}
@end
#import "LauncherController.h"
@implementation LauncherController
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
if (self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil])
{
self.title = @"Launcher Screen";
}
return self;
}
- (void)dealloc
{
[super dealloc];
}
- (void)loadView
{
[super loadView];
_launcherView = [[TTLauncherView alloc] initWithFrame:self.view.bounds];
_launcherView.backgroundColor = [UIColor whiteColor];
_launcherView.delegate = self;
_launcherView.columnCount = 2;
_launcherView.pages =
[NSArray arrayWithObjects:
[[[TTLauncherItem alloc] initWithTitle:@"New Position" image:@"bundle://ic_positions2.png" URL:nil] autorelease], nil];
[self.view addSubview:_launcherView];
}
- (void)launcherView:(TTLauncherView*)launcher didSelectItem:(TTLauncherItem*)item {
}
- (void)launcherViewDidBeginEditing:(TTLauncherView*)launcher {
[self.navigationItem setRightBarButtonItem:[[[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemDone
target:_launcherView action:@selector(endEditing)] autorelease] animated:YES];
}
- (void)launcherViewDidEndEditing:(TTLauncherView*)launcher {
[self.navigationItem setRightBarButtonItem:nil animated:YES];
}
@end
Any thoughts on why I'd get the following screen?
Upvotes: 1
Views: 680
Reputation: 2141
Please check your main.m file for the following line:
int retVal = UIApplicationMain(argc, argv, nil, nil);
You will need to change the last parameter to a string containing the name of your app delegate. In your case, you would write:
int retVal = UIApplicationMain(argc, argv, nil, @"AppDelegate");
Upvotes: 6
Reputation: 26400
Pls check if the main window of app delegate is made visible and the necessary view is added to the main window.
[self.window makeKeyAndVisible];
[self.window addSubview:startingview];
Upvotes: 0