What are the differences between toViewController, toSharedViewController and toModalViewController when used with TTURLMap?
TTURLMap* map = navigator.URLMap;
[map from:@"*" toViewController:[TTWebController class]];
[map from:@"tt://tabBar" toSharedViewController:[TabBarController class]];
[map from:@"tt://order?waitress=(initWithWaitress:)"
toModalViewController:[ContentController class]];
Using
(void)from:(NSString*)URL toViewController:(id)targetwill always recreate the UIViewController from scratch and won’t try to reuse an existing view controller.So for example, if you call
TTOpenURL(@"tt://details/view/1)twice, it will create the view controller twice.On the other hand, if you use
(void)from:(NSString*)URL toSharedViewController:(id)target, theTTNaviagtorwill create the controllers in shared mode and reuse them. It’s good for menus in tab bar views.so if you call
TTOpenURL(@"tt://menu/1)twice for a url that was created with toSharedViewController, it will reuse an existing view controller (if the controller is in the TTNavigator stack and wasn’t released by a memory warning)the last option,
(void)from:(NSString*)URL toModalViewController:(id)targetwill display the view controller by pushing it without using the existingUINavigationBar. It’s helpful if you need to present a “send email” view, or something that already has a UINavigationBar.