2011-04-25 35 views
0

嗨,我是一个newbee到three20。我得到“SettingsViewController setOriginalNavigatorURL无法识别的选择器发送”异常。如果我的应用程序中已经有导航控制器,我该如何使用TTLauncherView?Three20:TTLauncherView使用presentModalViewController抛出setOriginalNavigatorURL无法识别的选择器

我在UINavigationController中有一个UITableViewController。我想在表格中选择“设置”行时启动启动器。以下是我做了什么:

- (void)tableView:(UITableView *)tableView 
     didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    switch ([indexPath row]){ 
     case 0: 
     [self launchSettings]; 
     break; 
    // .... 
} 

-(void)launchSettings 
{ 

    TTNavigator* navigator = [TTNavigator navigator]; 
    navigator.persistenceMode = TTNavigatorPersistenceModeAll; 
    TTURLMap* map = navigator.URLMap; 
    [map from:@"*" toViewController:[TTWebController class]]; 
    [map from:@"tt://launcher/" toViewController: 
    [SettingsViewController class]]; 


    if (![navigator restoreViewControllers]) { 
     [navigator openURLAction: 
     [TTURLAction actionWithURLPath:@"tt://launcher"]]; 
    } 
    [self presentModalViewController:[navigator openURLAction: 
            [TTURLAction actionWithURLPath:@"tt://launcher"]] animated:YES]; 
} 

我有一个SettingsViewController:用的UIViewController的loadView,我创建了TTLauncherView和它作为子视图添加到SettingsViewController:

- (void)loadView { 
    [super loadView]; 
    TTLauncherView* launcherView = [[TTLauncherView alloc] 
            initWithFrame:self.view.bounds]; 
    launcherView.backgroundColor = [UIColor blackColor]; 
    launcherView.columnCount = 4; 
    launcherView.pages = [NSArray arrayWithObjects: 
          [NSArray arrayWithObjects: 
          [self launcherItemWithTitle:@"Google" 
           image:@"bundle://safari_logo.png" 
           URL:@"http://google.com"], 
          [self launcherItemWithTitle:@"Apple" 
           image:@"bundle://safari_logo.png" 
           URL:@"http://apple.com"] 
          , nil] 
          , nil]; 

    [self.view addSubview:launcherView]; 
    [launcherView release]; 
} 

- (TTLauncherItem *)launcherItemWithTitle:(NSString *)pTitle 
         image:(NSString *)image URL:(NSString *)url { 
    TTLauncherItem *launcherItem = [[TTLauncherItem alloc] 
         initWithTitle:pTitle 
         image:image 
         URL:url canDelete:YES]; 
    return [launcherItem autorelease]; 
} 

回答

0

语法错误?

switch ([indexPath row]){ 
    case 0: 
    launchSettings; -> [self launchSettings]; 
    break; 
+0

谢谢指出。是的,这是一个错字。 – savvybud 2011-04-25 18:05:12

相关问题