开发者

Three20: TTLauncherView using presentModalViewController throwing setOriginalNavigatorURL unrecognized selector

开发者 https://www.devze.com 2023-02-28 08:31 出处:网络
Hi I am a newbee to three20. I am getting \"SettingsViewController setOriginalNavigatorURL unrecognized selector sent\" exception. How do I use the TTLauncherView, if I already have a navigation contr

Hi I am a newbee to three20. I am getting "SettingsViewController setOriginalNavigatorURL unrecognized selector sent" exception. How do I use the TTLauncherView, if I already have a navigation controller in my app?

I have a UITableViewController within a UINavigationController. I want to launch a launcher when a row "Settings" is selected in the table. Following is what I have done:

- (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];
}

I have a SettingsViewController:UIViewController with loadView where I creat开发者_如何学Ced the TTLauncherView and add it as subview to 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];
}


Syntax error?

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


-ObjC -all_load was missing in the other compiler flags. These are required for using three20. see http://three20.info/article/2010-10-06-Adding-Three20-To-Your-Project

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号