[英]Three20: TTLauncherView using presentModalViewController throwing setOriginalNavigatorURL unrecognized selector
您好我是一個newbee到three20。 我收到“ SettingsViewController setOriginalNavigatorURL無法識別的選擇器已發送”異常。 如果我的應用程序中已有導航控制器,如何使用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];
}
我有一個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];
}
語法錯誤?
switch ([indexPath row]){
case 0:
launchSettings; -> [self launchSettings];
break;
-ObjC -all_load在其他編譯器標志中丟失。 這些是使用three20所必需的。 參見http://three20.info/article/2010-10-06-Adding-Three20-To-Your-Project
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.