My URL map is as follows:
[map from:@"tt://webPage/(initWithPage:)" toSharedViewController:[WebPageController class]];
and in the WebPageController
- (id) initWithPage:(WebPage)page
{
if (self = [super init])
{
...
Then I called the url several times in my code
tt://webPage/1
tt://webPage/2
tt://webPage/1 (still called the initWithPage: everytime, not cached)
Why it is not cached as it is a SharedViewController?
I believe this is happening to you because TTNaviagtor
is broken on iOS 5. see https://github.com/facebook/three20/pull/719/files. Have you tried running the same code on a iOS 4 with the same result?
My recommendation to you is to stop using TTNaviagtor
. You can still use the three20 library by pushing and poping TTViewController
in the native ios method.
Here's an example on replacing the TTNaviagtor
in your app delegate:
@interface AppDelegate : NSObject <UIApplicationDelegate> {
UIWindow* _window;
TTBaseNavigationController* _masterNavController;
WebPageController* _web1Controller;
WebPageController* _web2Controller;
}
@property(nonatomic, retain) UIWindow* window;
@property(nonatomic, retain) TTBaseNavigationController* masterNavController;
@property(nonatomic, retain) WebPageController* web1Controller;
@property(nonatomic, retain) WebPageController* web2Controller;
And
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
///////////////////////////////////////////////////////////////////////////////////////////////////
@implementation AppDelegate
@synthesize window = _window;
@synthesize masterNavController = _masterNavController;
@synthesize web1Controller = _web1Controller;
@synthesize web2Controller = web2Controller;
///////////////////////////////////////////////////////////////////////////////////////////////////
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
_window = [[UIWindow alloc] initWithFrame:TTScreenBounds()];
TTViewController* controller = [[[MasterViewController alloc] init] autorelease];
_masterNavController = [[TTBaseNavigationController alloc] initWithRootViewController:controller];
[_window addSubview:_masterNavController.view];
}
[_window makeKeyAndVisible];
return YES;
}
then you can push and pop any TTViewController
(or your own subclasses of TTViewController
) into the _masterNavController
. Personally, i think TTNavigator is a bad design pattern, and apple designed their navigation system in different mindset.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With