Iphone 将TTViewController映射为具有xib的根

Iphone 将TTViewController映射为具有xib的根,iphone,three20,Iphone,Three20,我试图使用three20创建一个应用程序,但在设置TTnavigator的根viewcontroller时遇到了问题 这是映射代码 TTURLMap* map = navigator.URLMap; [map from:@"*" toViewController:[TTWebController class]]; [map from:@"tt://root/(loadFromNib:)/(withClass:)" toViewController:[MainViewController

我试图使用three20创建一个应用程序,但在设置TTnavigator的根viewcontroller时遇到了问题

这是映射代码

    TTURLMap* map = navigator.URLMap;
[map from:@"*" toViewController:[TTWebController class]];
[map from:@"tt://root/(loadFromNib:)/(withClass:)" toViewController:[MainViewController class]];
很明显我做错了什么


提前谢谢:)

我终于明白了

这是我的解决方案

    -(void)applicationDidFinishLaunching:(UIApplication *)application
{
    TTNavigator * navigator = [TTNavigator navigator];
    navigator.persistenceMode = TTNavigatorPersistenceModeAll;
    navigator.window = self.window;

    TTURLMap* map = navigator.URLMap;
    [map from:@"*" toViewController:[TTWebController class]];
    [map from:@"tt://root/(loadFromNib:)/(withClass:)" toSharedViewController:self];

    if (![navigator restoreViewControllers]) {
        [navigator openURLAction:[TTURLAction actionWithURLPath:@"tt://root/MainViewController/MainViewController"]];
    }

}
/**
 * Loads the given viewcontroller from the nib
 */
- (UIViewController*)loadFromNib:(NSString *)nibName withClass:className {
    UIViewController* newController = [[NSClassFromString(className) alloc]
                                       initWithNibName:nibName bundle:nil];
    [newController autorelease];

    return newController;
}


///////////////////////////////////////////////////////////////////////////////////////////////////
/**
 * Loads the given viewcontroller from the the nib with the same name as the
 * class
 */
- (UIViewController*)loadFromNib:(NSString*)className {
    return [self loadFromNib:className withClass:className];
}


///////////////////////////////////////////////////////////////////////////////////////////////////
/**
 * Loads the given viewcontroller by name
 */
- (UIViewController *)loadFromVC:(NSString *)className {
    UIViewController * newController = [[ NSClassFromString(className) alloc] init];
    [newController autorelease];

    return newController;
}


- (BOOL)application:(UIApplication*)application handleOpenURL:(NSURL*)URL {
    [[TTNavigator navigator] openURLAction:[TTURLAction actionWithURLPath:URL.absoluteString]];
    return YES;
}

您正在使用TTNavigator。这就是你做错的;-)您仍然可以在没有TTNavigator的情况下使用three20。只需按旧的“苹果时尚”按钮/弹出TTViewController