【iOS】UI学习——导航控制器、分栏控制器

打印 上一主题 下一主题

主题 512|帖子 512|积分 1538

导航控制器


导航控制器负责控制导航栏(navigationBar),导航栏上的按钮叫UINavigationItem(导航元素项)。它还控制着一个视图控制器,即导航栏下面的东西。
导航控制器基础

  1. #import "SceneDelegate.h"
  2. #import "VCRoot.h"
  3. @interface SceneDelegate ()
  4. @end
  5. @implementation SceneDelegate
  6. - (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
  7.     //创建一个根视图控制器
  8.     VCRoot* root = [[VCRoot alloc] init];
  9.     //创建导航控制器
  10.     //导航控制器主要用来管理多个视图控制器的切换
  11.     //层级的方式来管理多个视图控制器
  12.     //创建控制器时,一定要有一个根视图控制器
  13.     //P1:就是作为导航控制器的根视图控制器
  14.     UINavigationController* rev = [[UINavigationController alloc] initWithRootViewController:root];
  15.     //将window的根视图设置为导航控制器
  16.     self.window.rootViewController = rev;
  17.     [self.window makeKeyAndVisible];
  18. }
复制代码
新建一个VCRoot类
  1. #import "VCRoot.h"
  2. @interface VCRoot ()
  3. @end
  4. @implementation VCRoot
  5. - (void)viewDidLoad {
  6.     [super viewDidLoad];
  7.     //设置导航栏的透明度
  8.     //默认透明度为YES:可透明的
  9.     self.navigationController.navigationBar.translucent = NO;
  10.     self.view.backgroundColor = [UIColor greenColor];
  11.     //设置导航栏的标题文字
  12.     self.title = @"娃哈哈";
  13.     //设置导航元素项目的标题
  14.     //如果没有设置元素项目的标题,系统会使用self.title作为标题;反之,优先为navigationItem.title
  15.     self.navigationItem.title = @"娃哈哈1";
  16.     //向左侧按钮中添加文字,这里是根据title文字来创建
  17.     //P1:栏按钮项的标题
  18.     //P2:按钮的样式
  19.     //P3:接受动作的目标对象
  20.     UIBarButtonItem* leftBtn = [[UIBarButtonItem alloc] initWithTitle:@"旺仔牛奶" style:UIBarButtonItemStyleDone target:self action:@selector(pressLeft)];
  21.    
  22.     self.navigationItem.leftBarButtonItem = leftBtn;
  23.     //右侧按钮中的文字是不可变的
  24.     //这里按钮是制定了系统提供的风格样式
  25.     //P1:按钮中展现的东西,注意,这里无论按钮中展现的是什么内容(无论图案或者文字),都是不可改变的
  26.     UIBarButtonItem* rightBtn = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemAction target:self action:@selector(pressRight)];
  27.     //向右侧添加自定义按钮
  28.     UILabel* label = [[UILabel alloc] initWithFrame:CGRectMake(10, 10, 50, 40)];
  29.     label.text = @"矿泉水";
  30.     //将文字调至中间位置
  31.     label.textAlignment = NSTextAlignmentCenter;
  32.     label.textColor = [UIColor blackColor];
  33.     //UIView的子类都可以被添加
  34.     UIBarButtonItem* item = [[UIBarButtonItem alloc] initWithCustomView:label];
  35.     //数组展现顺序从右至左
  36.     NSArray* array = [NSArray arrayWithObjects:item, rightBtn, nil];
  37.     //将右侧按钮数组赋值
  38.     self.navigationItem.rightBarButtonItems = array;
  39.     //self.navigationItem.rightBarButtonItem = rightBtn;
  40. }
  41. -(void) pressLeft
  42. {
  43.     NSLog(@"按下了左侧按钮");
  44. }
  45. -(void) pressRight
  46. {
  47.     NSLog(@"按下了右侧按钮");
  48. }
复制代码
效果图

导航控制器切换

navigationBar:导航栏对象
navigationItem:导航元素项对象
translucent:导航栏透明度
pushViewController:推入视图控制器
popViewController:推出视图控制器
首先创建三个视图
根视图VCRoot.m
  1. #import "VCRoot.h"
  2. #import "VCTwo.h"
  3. @interface VCRoot ()
  4. @end
  5. @implementation VCRoot
  6. - (void)viewDidLoad {
  7.     [super viewDidLoad];
  8.     // Do any additional setup after loading the view.
  9.     self.view.backgroundColor = [UIColor greenColor];
  10.     //设置导航栏的透明度,默认为YES:可透明的;NO:不可透明的
  11.     self.navigationController.navigationBar.translucent = NO;
  12.     self.title = @"哦哦哦";
  13.     //设置导航栏的风格颜色,默认为Default
  14.     self.navigationController.navigationBar.barStyle = UIBarStyleDefault;
  15.     //为根视图的导航控制器设置右侧按钮
  16.     UIBarButtonItem* rightBtn = [[UIBarButtonItem alloc] initWithTitle:@"下一页" style:UIBarButtonItemStylePlain target:self action:@selector(pressRight)];
  17.     self.navigationItem.rightBarButtonItem = rightBtn;
  18. }
  19. -(void) pressRight
  20. {
  21.     //创建新的视图控制器
  22.     VCTwo* vcTwo = [[VCTwo alloc] init];
  23.     //使用当前视图控制器的导航控制器对象
  24.     [self.navigationController pushViewController:vcTwo animated:YES];
  25. }
复制代码
第二个视图VCTwo.h
  1. #import "VCTwo.h"
  2. #import "VCRoot.h"
  3. #import "VCThree.h"
  4. @interface VCTwo ()
  5. @end
  6. @implementation VCTwo
  7. @synthesize elertView = _elertView;
  8. - (void)viewDidLoad {
  9.     [super viewDidLoad];
  10.     // Do any additional setup after loading the view.
  11.     //设置视图二的标题和颜色
  12.     self.view.backgroundColor = [UIColor blueColor];
  13.     UIBarButtonItem* leftBtn = [[UIBarButtonItem alloc] initWithTitle:@"上一页" style:UIBarButtonItemStylePlain target:self action:@selector(pressLeft)];
  14.     UIBarButtonItem* rightBtn = [[UIBarButtonItem alloc] initWithTitle:@"下一页" style:UIBarButtonItemStylePlain target:self action:@selector(pressRight)];
  15.     self.navigationItem.leftBarButtonItem = leftBtn;
  16.     //[self create];
  17.     self.navigationItem.rightBarButtonItem = rightBtn;
  18. }
  19. -(void) pressLeft
  20. {
  21.      //弹出当前视图控制器,返回上一个界面
  22.     [self.navigationController popViewControllerAnimated:YES];
  23. }
  24. -(void) pressRight
  25. {
  26.     VCThree* vcThree = [[VCThree alloc] init];
  27.     //推入第三个视图控制器对象
  28.     [self.navigationController pushViewController:vcThree animated:YES];
  29. }
复制代码
第三个视图VCThree.h
  1. #import "VCThree.h"
  2. #import "VCRoot.h"
  3. #import "VCTwo.h"
  4. @interface VCThree ()
  5. @end
  6. @implementation VCThree
  7. - (void)viewDidLoad {
  8.     [super viewDidLoad];
  9.     // Do any additional setup after loading the view.
  10.     self.view.backgroundColor = [UIColor redColor];
  11.     UIBarButtonItem* leftBtn = [[UIBarButtonItem alloc] initWithTitle:@"上一页" style:UIBarButtonItemStylePlain target:self action:@selector(pressLeft)];
  12.     UIBarButtonItem* rightBtn = [[UIBarButtonItem alloc] initWithTitle:@"下一页" style:UIBarButtonItemStylePlain target:self action:@selector(pressRight)];
  13.     self.navigationItem.leftBarButtonItem = leftBtn;
  14.     self.navigationItem.rightBarButtonItem = rightBtn;
  15. }
  16. -(void) pressLeft
  17. {
  18.     [self.navigationController popViewControllerAnimated:YES];
  19. }
  20. -(void) pressRight
  21. {
  22.     //弹出当前视图,返回根视图
  23.     [self.navigationController popToRootViewControllerAnimated:YES];
  24. }
复制代码
效果图



导航栏和工具栏

ScenDelegate.m
  1. #import "SceneDelegate.h"
  2. #import "VCRoot.h"
  3. @interface SceneDelegate ()
  4. @end
  5. @implementation SceneDelegate
  6. - (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
  7.     VCRoot* vac = [[VCRoot alloc] init];
  8.     UINavigationController* ans = [[UINavigationController alloc] initWithRootViewController:vac];
  9.     self.window.rootViewController = ans;
  10.     [self.window makeKeyAndVisible];
  11. }
  12. - (void)sceneDidDisconnect:(UIScene *)scene {
  13.     // Called as the scene is being released by the system.
  14.     // This occurs shortly after the scene enters the background, or when its session is discarded.
  15.     // Release any resources associated with this scene that can be re-created the next time the scene connects.
  16.     // The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead).
  17. }
  18. - (void)sceneDidBecomeActive:(UIScene *)scene {
  19.     // Called when the scene has moved from an inactive state to an active state.
  20.     // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
  21. }
  22. - (void)sceneWillResignActive:(UIScene *)scene {
  23.     // Called when the scene will move from an active state to an inactive state.
  24.     // This may occur due to temporary interruptions (ex. an incoming phone call).
  25. }
  26. - (void)sceneWillEnterForeground:(UIScene *)scene {
  27.     // Called as the scene transitions from the background to the foreground.
  28.     // Use this method to undo the changes made on entering the background.
  29. }
  30. - (void)sceneDidEnterBackground:(UIScene *)scene {
  31.     // Called as the scene transitions from the foreground to the background.
  32.     // Use this method to save data, release shared resources, and store enough scene-specific state information
  33.     // to restore the scene back to its current state.
  34. }
  35. @end
复制代码
VCRoot.h
  1. #import "VCRoot.h"
  2. #import "VCSecond.h"
  3. @interface VCRoot ()
  4. @end
  5. @implementation VCRoot
  6. - (void)viewDidLoad {
  7.     [super viewDidLoad];
  8.     // Do any additional setup after loading the view.
  9.     self.view.backgroundColor = [UIColor yellowColor];
  10.    
  11.     self.title = @"根视图";
  12.    
  13.     UIBarButtonItem* btn = [[UIBarButtonItem alloc] initWithTitle:@"Right" style:UIBarButtonItemStylePlain target:nil action:nil];
  14.    
  15.     self.navigationItem.rightBarButtonItem = btn;
  16.     UINavigationBarAppearance* appearance = [[UINavigationBarAppearance alloc] init];
  17.     //设置该对象的背景颜色
  18.     appearance.backgroundColor = [UIColor redColor];
  19.     //创建该对象的阴影图像
  20.     appearance.shadowImage = [[UIImage alloc] init];
  21.     //设置该对象的阴影颜色
  22.     appearance.shadowColor = nil;
  23.     //设置导航栏按钮的颜色
  24.     self.navigationController.navigationBar.tintColor = [UIColor blueColor];
  25.     //设置普通样式导航栏
  26.     self.navigationController.navigationBar.standardAppearance = appearance;
  27.     //设置滚动样式导航栏
  28.     self.navigationController.navigationBar.scrollEdgeAppearance = appearance;
  29.    
  30.     self.navigationController.navigationBar.hidden = NO;
  31.    
  32.     self.navigationController.navigationBarHidden = NO;
  33.     //显示工具栏对象
  34.     //默认工具栏是隐藏的
  35.     self.navigationController.toolbarHidden = NO;
  36.     //设置工具栏是否透明
  37.     self.navigationController.toolbar.translucent = NO;
  38.     //向工具栏添加第一个按钮
  39.     UIBarButtonItem* btn1 = [[UIBarButtonItem alloc] initWithTitle:@"left" style:UIBarButtonItemStylePlain target:nil action:nil];
  40.     //向工具栏添加第二个按钮
  41.     UIBarButtonItem* btn2 = [[UIBarButtonItem alloc] initWithTitle:@"right" style:UIBarButtonItemStylePlain target:nil action:@selector(press)];
  42.     //添加一个自定义按钮
  43.     UIButton *btnC = [UIButton buttonWithType: UIButtonTypeCustom];
  44.     [btnC setImage: [UIImage imageNamed: @"12.png"] forState: UIControlStateNormal];
  45.     btnC.frame = CGRectMake(0, 0, 60, 60);
  46.         
  47.     UIBarButtonItem *btn3 = [[UIBarButtonItem alloc] initWithCustomView: btnC];
  48.         
  49.     //设置一个占位按钮,放到数组中可以用来分隔开各按钮
  50.     //设置宽度固定按钮
  51.     UIBarButtonItem *btnF1 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem: UIBarButtonSystemItemFixedSpace target: nil action: nil];
  52.     btnF1.width = 110;
  53.         
  54.     //设置自动计算宽度按钮
  55.     UIBarButtonItem *btnF2 = [[UIBarButtonItem alloc] initWithBarButtonSystemItem: UIBarButtonSystemItemFlexibleSpace target: nil action: nil];
  56.     //按钮数组的创建
  57.     NSArray *arrayBtn = [NSArray arrayWithObjects: btn1, btnF2, btn3, btnF2, btn2, nil];
  58.         
  59.     self.toolbarItems = arrayBtn;
  60.    
  61. }
复制代码
效果图

分栏控制器

分栏控制器是管理多个视图控制器的管理控制器,通过数组的方式管理多个平行关系的视图控制器,与导航控制器的区别在于:导航控制器管理的是有层级关系的控制器
   注意:
分栏控制器在同一界面最多显示5个控制器切换按钮,超过5个时会自动创建一个新的导航控制器来管理其余的控制器。
  分栏控制器基础

UITabBarItem:分栏按钮元素对象
badgeValue:分栏按钮提示信息
selectedIndex:分栏控制器选中的控制器索引
viewControllers:分栏控制器管理数组
selectedViewController:分栏控制器选中的控制器对象
VCone类
  1. #import "VCone.h"
  2. @interface VCone ()
  3. @end
  4. @implementation VCone
  5. - (void)viewDidLoad {
  6.     [super viewDidLoad];
  7.     // Do any additional setup after loading the view.
  8.     //创建一个分栏按钮对象
  9.     //P1:显示的文字
  10.     //P2:显示图片图标
  11.     //P3:设置按钮的tag
  12.     UITabBarItem* tab = [[UITabBarItem alloc] initWithTitle:@"111" image:nil tag:101];
  13.    
  14.     self.tabBarItem = tab;
  15. }
  16. @end
复制代码
VCtow类
  1. #import "VCtwo.h"
  2. @interface VCtwo ()
  3. @end
  4. @implementation VCtwo
  5. - (void)viewDidLoad {
  6.     [super viewDidLoad];
  7.     // Do any additional setup after loading the view.
  8.     //根据系统风格创建分栏按钮
  9.     //P1:系统风格设定
  10.     UITabBarItem* tab = [[UITabBarItem alloc] initWithTabBarSystemItem:UITabBarSystemItemContacts tag:111];
  11.     tab.badgeValue = @"11";
  12.    
  13.     self.tabBarItem = tab;
  14. }
  15. @end
复制代码
VCthree类
  1. #import "VCthree.h"
  2. @interface VCthree ()
  3. @end
  4. @implementation VCthree
  5. - (void)viewDidLoad {
  6.     [super viewDidLoad];
  7.     // Do any additional setup after loading the view.
  8. }
  9. /*
  10. #pragma mark - Navigation
  11. // In a storyboard-based application, you will often want to do a little preparation before navigation
  12. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  13.     // Get the new view controller using [segue destinationViewController].
  14.     // Pass the selected object to the new view controller.
  15. }
  16. */
  17. @end
复制代码
SceneDelegate.m
  1. #import "SceneDelegate.h"
  2. #import "VCone.h"
  3. #import "VCtwo.h"
  4. #import "VCthree.h"
  5. @interface SceneDelegate ()
  6. @end
  7. @implementation SceneDelegate
  8. - (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
  9.     //创建视图控制器1、2、3
  10.     VCone* vc1 = [[VCone alloc] init];
  11.    
  12.     vc1.title = @"视图一";
  13.     vc1.view.backgroundColor = [UIColor whiteColor];
  14.    
  15.     VCtwo* vc2 = [[VCtwo alloc] init];
  16.     vc2.title = @"视图二";
  17.     vc2.view.backgroundColor = [UIColor redColor];
  18.    
  19.     VCthree* vc3 = [[VCthree alloc] init];
  20.     vc3.view.backgroundColor = [UIColor orangeColor];
  21.     vc3.title = @"视图三";
  22.     //创建分栏控制器对象
  23.     UITabBarController* tbController = [[UITabBarController alloc] init];
  24.    
  25.     //创建一个控制器数组对象
  26.     //将所有要被分栏控制器管理的对象添加到数组中去
  27.     NSArray* arrVC = [NSArray arrayWithObjects:vc1, vc2, vc3, nil];
  28.     //给分栏控制器管理数组赋值
  29.     tbController.viewControllers = arrVC;
  30.     //将分栏控制器作为根视图控制器
  31.     self.window.rootViewController = tbController;
  32.     //设置选中的视图控制器的索引
  33.     tbController.selectedIndex = 2;
  34.     //当前显示的控制器对象
  35.     if(tbController.selectedViewController == vc3) {
  36.         NSLog(@"Right");
  37.     }
  38.     //是否分栏控制器的工具栏的透明度
  39.     tbController.tabBar.translucent = NO;
  40.     //分栏控制器的颜色
  41.     tbController.tabBar.backgroundColor = [UIColor whiteColor];
  42.    
  43.    
  44.    
  45.    
  46. }
  47. - (void)sceneDidDisconnect:(UIScene *)scene {
  48.     // Called as the scene is being released by the system.
  49.     // This occurs shortly after the scene enters the background, or when its session is discarded.
  50.     // Release any resources associated with this scene that can be re-created the next time the scene connects.
  51.     // The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead).
  52. }
  53. - (void)sceneDidBecomeActive:(UIScene *)scene {
  54.     // Called when the scene has moved from an inactive state to an active state.
  55.     // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
  56. }
  57. - (void)sceneWillResignActive:(UIScene *)scene {
  58.     // Called when the scene will move from an active state to an inactive state.
  59.     // This may occur due to temporary interruptions (ex. an incoming phone call).
  60. }
  61. - (void)sceneWillEnterForeground:(UIScene *)scene {
  62.     // Called as the scene transitions from the background to the foreground.
  63.     // Use this method to undo the changes made on entering the background.
  64. }
  65. - (void)sceneDidEnterBackground:(UIScene *)scene {
  66.     // Called as the scene transitions from the foreground to the background.
  67.     // Use this method to save data, release shared resources, and store enough scene-specific state information
  68.     // to restore the scene back to its current state.
  69. }
  70. @end
复制代码
效果图

分栏控制器高级

willBeginCustomizingViewControllers:即将显示编辑方法
willEndCustomizingViewControllers:即将结束编辑方法
didEndCustomizingViewControllers:已经结束编辑方法
didSelectViewController:选中控制器切换方法
分栏控制器下面的导航栏最多显示5个按钮,超过5个按钮,体系会自动将末了一个按钮更换成more,当点击more时,才可以看到其他的按钮,点开后,右上角有一个Edit按钮,点击可以看到全部的按钮,也可拖动改变前四个按钮显现的是什么视图。
UITabBarControllerDelegate协议
先创建VCone-Vcsix类,这里指显现VCone类:
  1. #import "VCone.h"
  2. @interface VCone ()
  3. @end
  4. @implementation VCone
  5. - (void)viewDidLoad {
  6.     [super viewDidLoad];
  7.     // Do any additional setup after loading the view.
  8. }
  9. /*
  10. #pragma mark - Navigation
  11. // In a storyboard-based application, you will often want to do a little preparation before navigation
  12. - (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
  13.     // Get the new view controller using [segue destinationViewController].
  14.     // Pass the selected object to the new view controller.
  15. }
  16. */
  17. @end
复制代码
SceneDelegate.m
  1. #import "SceneDelegate.h"
  2. #import "VCone.h"
  3. #import "VCtwo.h"
  4. #import "VCthree.h"
  5. #import "VCfour.h"
  6. #import "VCfive.h"
  7. #import "VCsix.h"
  8. @interface SceneDelegate ()
  9. @end
  10. @implementation SceneDelegate
  11. - (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {
  12.     VCone* vc1 = [[VCone alloc] init];
  13.     vc1.title = @"视图1";
  14.     vc1.view.backgroundColor = [UIColor redColor];
  15.    
  16.     VCtwo* vc2 = [[VCtwo alloc] init];
  17.     vc2.title = @"视图2";
  18.     vc2.view.backgroundColor = [UIColor orangeColor];
  19.    
  20.     VCthree* vc3 = [[VCthree alloc] init];
  21.     vc3.title = @"视图3";
  22.     vc3.view.backgroundColor = [UIColor blueColor];
  23.    
  24.     VCfour* vc4 = [[VCfour alloc] init];
  25.     vc4.title = @"视图4";
  26.     vc4.view.backgroundColor = [UIColor greenColor];
  27.    
  28.     VCfive* vc5 = [[VCfive alloc] init];
  29.     vc5.title = @"视图5";
  30.     vc5.view.backgroundColor = [UIColor grayColor];
  31.    
  32.     VCsix* vc6 = [[VCsix alloc] init];
  33.     vc6.title = @"视图6";
  34.     vc6.view.backgroundColor = [UIColor yellowColor];
  35.    
  36.    
  37.     NSArray* arrVC = [NSArray arrayWithObjects:vc1, vc2, vc3, vc4, vc5, vc6, nil];
  38.     UITabBarController* tb = [[UITabBarController alloc] init];
  39.     tb.viewControllers = arrVC;
  40.     tb.tabBar.translucent = NO;
  41.     tb.tabBar.backgroundColor = [UIColor whiteColor];
  42.     self.window.rootViewController = tb;
  43.     //设置代理
  44.     //处理UITabBarControllerDelegate协议函数
  45.     tb.delegate = self;
  46. }
  47. //开始编译前调用此协议函数
  48. -(void) tabBarController:(UITabBarController *)tabBarController willBeginCustomizingViewControllers:(NSArray<__kindof UIViewController *> *)viewControllers
  49. {
  50.     NSLog(@"编辑前");
  51. }
  52. //即将结束编译前调用此协议函数
  53. -(void) tabBarController:(UITabBarController *)tabBarController willEndCustomizingViewControllers:(NSArray<__kindof UIViewController *> *)viewControllers changed:(BOOL)changed
  54. {
  55.     NSLog(@"即将结束前");
  56. }
  57. //结束编译后调用此协议函数
  58. -(void) tabBarController:(UITabBarController *)tabBarController didEndCustomizingViewControllers:(NSArray<__kindof UIViewController *> *)viewControllers changed:(BOOL)changed
  59. {
  60.     if(changed == YES) {
  61.         NSLog(@"顺序发生改变");
  62.     }
  63.     NSLog(@"已经结束编辑");
  64. }
  65. //选中控制器对象调用此协议函数
  66. -(void) tabBarController:(UITabBarController *)tabBarController didSelectViewController:(UIViewController *)viewController
  67. {
  68.     NSLog(@"选中控制器对象");
  69. }
  70. - (void)sceneDidDisconnect:(UIScene *)scene {
  71.     // Called as the scene is being released by the system.
  72.     // This occurs shortly after the scene enters the background, or when its session is discarded.
  73.     // Release any resources associated with this scene that can be re-created the next time the scene connects.
  74.     // The scene may re-connect later, as its session was not necessarily discarded (see `application:didDiscardSceneSessions` instead).
  75. }
  76. - (void)sceneDidBecomeActive:(UIScene *)scene {
  77.     // Called when the scene has moved from an inactive state to an active state.
  78.     // Use this method to restart any tasks that were paused (or not yet started) when the scene was inactive.
  79. }
  80. - (void)sceneWillResignActive:(UIScene *)scene {
  81.     // Called when the scene will move from an active state to an inactive state.
  82.     // This may occur due to temporary interruptions (ex. an incoming phone call).
  83. }
  84. - (void)sceneWillEnterForeground:(UIScene *)scene {
  85.     // Called as the scene transitions from the background to the foreground.
  86.     // Use this method to undo the changes made on entering the background.
  87. }
  88. - (void)sceneDidEnterBackground:(UIScene *)scene {
  89.     // Called as the scene transitions from the foreground to the background.
  90.     // Use this method to save data, release shared resources, and store enough scene-specific state information
  91.     // to restore the scene back to its current state.
  92. }
  93. @end
复制代码
效果图

点击more后

点击Edit后


免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作!更多信息从访问主页:qidao123.com:ToB企服之家,中国第一个企服评测及商务社交产业平台。

本帖子中包含更多资源

您需要 登录 才可以下载或查看,没有账号?立即注册

x
回复

使用道具 举报

0 个回复

倒序浏览

快速回复

您需要登录后才可以回帖 登录 or 立即注册

本版积分规则

拉不拉稀肚拉稀

金牌会员
这个人很懒什么都没写!

标签云

快速回复 返回顶部 返回列表