嗨,我是three20的新手。我收到“SettingsViewController setOriginalNavigatorURL unrecognized selector sent”异常。如果我的应用程序中已有导航控制器,如何使用 TTLauncherView?
我在 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];
}
我有一个带有 loadView 的 SettingsViewController:UIViewController 我在其中创建了 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];
}