TTNavigator: How to pass a parameter to a custom UIWebView?

482 views Asked by At

I have implemented a TTNavigator with this url map:

TTNavigator* navigator = [TTNavigator navigator];
navigator.persistenceMode = TTNavigatorPersistenceModeNone;
TTURLMap* map = navigator.URLMap;
[map from:@"tt://launcher/" toViewController:   [LauncherViewController class]];
[map from:@"tt://onlineCall/(callOnlineURL:)" toViewController: [CustomWebController class]];

Well, when a call by Launcher's item:

item =
[[TTLauncherItem alloc] initWithTitle: @"Online"
                                image: @"bundle://safari_logo.png"
                                  URL: @"tt://onlineCall/www.google.it"];
[launcherView addItem:item animated:YES];

my CustomWebController doesn't show.. how i can call "loadView" internally ???

thanks for help

1

There are 1 answers

0
Andrew Flynn On

Instead of trying to pass in the URL as a param in the TTURL, I think you might find it easier to create a class that extends TTWebController that would allow you to do whatever customizations you need to do. Then you would map the web URLs you want to go to that page to load up your custom controller

So your new class would like this:

@interface CustomWebController : TTWebController {
}

@end

@implementation CustomWebController
    // Customizations
}

@end

and then you would add a mapping to your TTURLMap

[map from:@"www.google.it" toViewController: [CustomWebController class]];

and your launcher item

[[TTLauncherItem alloc] initWithTitle: @"Online"
                        image: @"bundle://safari_logo.png"
                        URL: @"www.google.it"];