【UIKit-65-1】#import <UIKit/UINavigationController.h>UINavgationVC基础
来源:互联网 发布:电影 知乎 编辑:程序博客网 时间:2024/06/08 00:16
@interface UINavigationController :UIViewController
初始化
- (instancetype)initWithNavigationBarClass:(Class)navigationBarClass toolbarClass:(Class)toolbarClassNS_AVAILABLE_IOS(5_0);
- (instancetype)initWithRootViewController:(UIViewController *)rootViewController;
//自定义?// UINavigationController *nav = [[UINavigationController alloc]initWithNavigationBarClass:[UINavigationController class] toolbarClass:[UIToolbar class]]; self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; ViewController *view = [ViewController new]; UINavigationController *nav = [[UINavigationController alloc]initWithRootViewController:view]; self.window.rootViewController = nav; self.window.backgroundColor = [UIColor whiteColor]; [self.window makeKeyAndVisible];
push pop
- (void)pushViewController:(UIViewController *)viewController animated:(BOOL)animated;
- (UIViewController *)popViewControllerAnimated:(BOOL)animated;
- (NSArray *)popToViewController:(UIViewController *)viewController animated:(BOOL)animated;
- (NSArray *)popToRootViewControllerAnimated:(BOOL)animated;
oneViewController *one = [oneViewController new]; [self.navigationController pushViewController:one animated:YES]; [self.navigationController popViewControllerAnimated:YES]; ViewController *view = [ViewController new]; [self.navigationController popToViewController:view animated:YES]; [self.navigationController popToViewController:view animated:YES]; [self.navigationController popToRootViewControllerAnimated:YES];
@property(nonatomic,readonly,retain)UIViewController *topViewController; 顶部vc
@property(nonatomic,readonly,retain)UIViewController *visibleViewController; 可见vc
所有push的vc,也可以直接push过去(跨越多个vc)
@property(nonatomic,copy)NSArray *viewControllers;// The current view controller stack.
- (void)setViewControllers:(NSArray *)viewControllers animated:(BOOL)animatedNS_AVAILABLE_IOS(3_0);
oneViewController *one = [oneViewController new]; twoViewController *two = [twoViewController new]; NSArray *arr = self.navigationController.viewControllers; NSLog(@"%@",arr); [self.navigationController setViewControllers:@[self,one,two]];
NavigationBar push pop 时是否隐藏,以及 bar :具体看 NavigationBar
@property(nonatomic,getter=isNavigationBarHidden)BOOL navigationBarHidden;
- (void)setNavigationBarHidden:(BOOL)hidden animated:(BOOL)animated;
@property(nonatomic,readonly)UINavigationBar *navigationBar;
oneViewController *one = [oneViewController new]; [self.navigationController setNavigationBarHidden:YES];或者: self.navigationController.navigationBarHidden = YES; [self.navigationController pushViewController:one animated:YES];
Toolbar push pop 时是否隐藏,以及 bar :具体看 NavigationBar 同上
@property(nonatomic,getter=isToolbarHidden)BOOL toolbarHidden NS_AVAILABLE_IOS(3_0);
- (void)setToolbarHidden:(BOOL)hidden animated:(BOOL)animatedNS_AVAILABLE_IOS(3_0);
@property(nonatomic,readonly)UIToolbar *toolbarNS_AVAILABLE_IOS(3_0);
oneViewController *one = [oneViewController new]; [self.navigationController setToolbarHidden:YES]; self.navigationController.toolbarHidden = YES; [self.navigationController pushViewController:one animated:YES];
@property(nonatomic,assign) id<UINavigationControllerDelegate> delegate; nav 的代理,具体看代理方法
左侧向右滑动,代替pop,(也可以自己设置方法,但是注意需要手势代理)
@property(nonatomic,readonly) UIGestureRecognizer *interactivePopGestureRecognizerNS_AVAILABLE_IOS(7_0);
// self.navigationController.interactivePopGestureRecognizer.enabled = YES; self.navigationController.interactivePopGestureRecognizer.delegate = self; [self.navigationController.interactivePopGestureRecognizer addTarget:self action:@selector(newPop)];-(void)newPop{ NSLog(@"pop");}
@end
- 【UIKit-65-1】#import <UIKit/UINavigationController.h>UINavgationVC基础
- 【UIKit-110-1】#import <UIKit/UITableView.h> 基础创建
- 【UIKit-124-1】#import <UIKit/UIView.h>
- 【UIKit-125-1】#import <UIKit/UIViewController.h>
- 【UIKit-93-1】#import <UIKit/UIScrollView.h>
- 【UIKit-124-2】#import <UIKit/UIView.h>
- 【UIKit-124-3】#import <UIKit/UIView.h>
- 【UIKit-124-4】#import <UIKit/UIView.h>
- 【UIKit-124-5】#import <UIKit/UIView.h>
- 【UIKit-124-6】#import <UIKit/UIView.h>
- 【UIKit-124-7】#import <UIKit/UIView.h>
- 【UIKit-124-8】#import <UIKit/UIView.h>
- 【UIKit-124-9】#import <UIKit/UIView.h>
- 【UIKit-124-10】#import <UIKit/UIView.h>
- 【UIKit-124-11】#import <UIKit/UIView.h>
- 【UIKit-125-2】#import <UIKit/UIViewController.h>
- 【UIKit-125-3】#import <UIKit/UIViewController.h>
- 【UIKit-125-4】#import <UIKit/UIViewController.h>
- jQuery删除元素方法remove(),detach(),empty()
- vb 无边框窗体拖动
- PHP(2)-变量
- 使用 Bochs 进行平台仿真
- 强调标签<strong> <em>
- 【UIKit-65-1】#import <UIKit/UINavigationController.h>UINavgationVC基础
- Android Sqlite框架 GreenDao的源码分析笔记
- spring aop的实现方式(一)
- 转:svn和git的区别,maven是什么
- JavaScript学习随记——数组一
- 使用<span>标签为文字设置单独样式
- Android 布局优化之include、merge、ViewStub
- Ubuntu系统上Python2和Python3共存时安装BeautifulSoup4
- 笔试怎么过(3)C++笔试