iphone – toSharedViewController不能重用现有的控制器
发布时间:2020-12-14 20:00:00 所属栏目:百科 来源:网络整理
导读:我的URL地图如下: [map from:@"tt://webPage/(initWithPage:)" toSharedViewController:[WebPageController class]]; 并在WebPageController中 - (id) initWithPage:(WebPage)page{ if (self = [super init]) { ... 然后我在我的代码中多次调用了url tt://w
我的URL地图如下:
[map from:@"tt://webPage/(initWithPage:)" toSharedViewController:[WebPageController class]]; 并在WebPageController中 - (id) initWithPage:(WebPage)page { if (self = [super init]) { ... 然后我在我的代码中多次调用了url tt://webPage/1 tt://webPage/2 tt://webPage/1 (still called the initWithPage: everytime,not cached) 为什么它不是缓存,因为它是一个SharedViewController? 解决方法
我相信这是发生在你身上的,因为TTNaviagtor在iOS 5上被破坏了.请参阅
https://github.com/facebook/three20/pull/719/files.您是否尝试在iOS 4上运行相同的代码并获得相同的结果?
我给你的建议是停止使用TTNaviagtor.您仍然可以通过在本机ios方法中推送和弹出TTViewController来使用three20库. 以下是替换应用代理中的TTNaviagtor的示例: @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; 和 /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////////////////////////////////////////// @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; } 然后你可以将任何TTViewController(或你自己的TTViewController子类)推送到_masterNavController中.就个人而言,我认为TTNavigator是一个糟糕的设计模式,而苹果以不同的心态设计了他们的导航系统. (编辑:李大同) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |