Three20 UINavigator

Three20 UINavigator

TTGlobalNavigatorMetrics
屏幕方向 大小 导航大小 键盘大小 状态栏大小 工具栏大小


TTURLObject @protocol
NSString *URLValue
– (NSString*)URLValueWithName:(NSString*)name;


TTBaseNavigationController

– (void)pushViewController: (UIViewController*)controller
animatedWithTransition: (UIViewAnimationTransition)transition;
动画推入新的界面

– (UIViewController*)popViewControllerAnimatedWithTransition:(UIViewAnimationTransition)transition;
动画推出当前界面


TTNavigatorRootContainer 定义了导航对象的根控制器设定与获取控制器的导航对象方法
– (void)navigator:(TTBaseNavigator*)navigator setRootViewController:(UIViewController*)controller;
– (TTBaseNavigator*)getNavigatorForController:(UIViewController*)controller;


TTBaseNavigator
自动持久化ViewController
包含 URLMap,
读写 window, rootContainer
只读 rootViewController, visibleViewController, topViewController
读写 URL 打开或获取当前的URL
读写 persistenceMode 持久化控制器的方法,默认不缓存
persistenceExpirationAge 缓存时间

读写 supportsShakeToReload 是否支持摇晃刷新
读写 opensExternalURLs 是否支持打开外链
读写 isDelayed 是否有任务延迟加载

/**
* Determines the navigator that contains this view.
*
* Traverse the view hierarchy until the root view container is reached. If this root container
* conforms to the TTNavigatorRootContainer protocol, we call getNavigatorForController:
* with the top-most controller that contains this view that /isn’t/ the container.
* If getNavigatorForController: returns a navigator, this navigator is returned.
* Otherwise, the global navigator is returned.
*
* If the given view is not, in fact, a view, which is the case if a UIBarButtonItem is passed,
* returns the global navigator via [TTBaseNavigator globalNavigator].
*
* If you need to use a specific navigator for UIBarButtonItem, handle the button tap
* yourself and use navigatorForView: on an actual view in the controller.
*/
+ (TTBaseNavigator*)navigatorForView:(UIView*)view;
判断包含view的导航
如果在点击TabBarButton后要使用某个Navigator可以用此方法

+ (TTBaseNavigator*)globalNavigator;
+ (void)setGlobalNavigator:(TTBaseNavigator*)navigator;

打开URL
– (UIViewController*)openURLAction:(TTURLAction*)URLAction;
– (UIViewController*)openURLs:(NSString*)URL,…; 打开一系列URL,结果为最后的URL

获取URL对应的Controller
– (UIViewController*)viewControllerForURL:(NSString*)URL;
– (UIViewController*)viewControllerForURL:(NSString*)URL query:(NSDictionary*)query;
– (UIViewController*)viewControllerForURL:(NSString*)URL query:(NSDictionary*)query
pattern:(TTURLPattern**)pattern;

– (void)beginDelay;
初始化控制器可能非常占用耗时和资源,如果在动画的过程中发生会应响用户的体验
通过这个方法可以在让导航器在生成控制器后再动论

– (void)endDelay
– (void)cancelDelay

– (void)persistViewControllers;
持久化所有

– (UIViewController*)restoreViewControllers
恢复控制器

– (void)persistController:(UIViewController*)controller path:(NSMutableArray*)path;

– (void)removeAllViewControllers;
去除并释放

对象与URL的映射
– (NSString*)pathForObject:(id)object;
– (id)objectForPath:(NSString*)path;
– (void)resetDefaults; 清空持久化的数据

发表评论

电子邮件地址不会被公开。 必填项已用*标注