当前位置: 首页 > wzjs >正文

平台网站模板 优帮云wordpress caller_get_posts

平台网站模板 优帮云,wordpress caller_get_posts,网站到期不想续费,wordpress多主题push 🆚 present 前言present和dismiss特点代码演示 push和pop特点代码演示 前言 在 iOS 开发中,push 和 present 是两种不同的视图控制器切换方式,它们有着显著的区别。 present和dismiss 特点 在当前控制器上方新建视图层级需要手动调用…

push 🆚 present

  • 前言
  • present和dismiss
    • 特点
    • 代码演示
  • push和pop
    • 特点
    • 代码演示

前言

在 iOS 开发中,pushpresent 是两种不同的视图控制器切换方式,它们有着显著的区别。

present和dismiss

特点

  • 在当前控制器上方新建视图层级
  • 需要手动调用dismiss
ViewController* vc = [[ViewController alloc] init];
[self presentViewController:vc2 animated:YES completion:nil];

对应的dismiss方法:(用于关闭或取消当前显示的视图、对话框等)

[self dismissViewControllerAnimated:YES completion:nil];
  • 默认从下向上滑入
  • 只保留当前presented的控制器
  • 可配置为全屏覆盖

代码演示

新建View02类作为视图控制器二

dimiss方法在View02文件中实现

#import "View02.h"@interface View02 ()@end@implementation View02- (void)viewDidLoad {[super viewDidLoad];self.view.backgroundColor = [UIColor cyanColor];
}-(void)touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event {[self dismissViewControllerAnimated:YES completion:nil];
}

作为视图控制器一

present方法在ViewController文件中实现

#import "ViewController.h"
#import "View02.h"
@interface ViewController ()@end@implementation ViewController- (void)viewDidLoad {[super viewDidLoad];[self creatUIRectButton];
}
- (void)creatUIRectButton {UIButton *btn1 = [UIButton buttonWithType:UIButtonTypeRoundedRect];btn1.frame = CGRectMake(10, 400, 120, 80);[btn1 setTitle:@"test button" forState:UIControlStateNormal];[btn1 setTitle:@"按下时候" forState:UIControlStateHighlighted];[btn1 addTarget:self action:@selector(press) forControlEvents:UIControlEventTouchUpInside];[btn1 setTintColor:[UIColor whiteColor]];btn1.backgroundColor = [UIColor grayColor];[self.view addSubview: btn1];
}
- (void) press {View02* vc = [[View02 alloc] init];[self presentViewController:vc animated:YES completion: nil];
}@end

运行效果:

在这里插入图片描述

push和pop

特点

  • 用于导航控制器堆栈中的视图控制器的界面切换。压入导航栈,成为栈顶控制器
ViewController* vc = [[ViewController alloc] init];
[self.navigationController pushViewController:vc animated:YES];

对应的消失视图方法为:

[self.navigationController popViewControllerAnimated:YES];
  • 系统自动生成返回按钮
  • 新视图从右向左滑入
  • 保留所有pushed的控制器
  • 不能全屏覆盖

代码演示

创建一个导航控制器:

//SceneDelegate.m
#import "SceneDelegate.h"
#import "VCRoot.h"
@interface SceneDelegate ()@end@implementation SceneDelegate- (void)scene:(UIScene *)scene willConnectToSession:(UISceneSession *)session options:(UISceneConnectionOptions *)connectionOptions {self.window.frame = [UIScreen mainScreen].bounds;UINavigationController *nav = [[UINavigationController alloc] initWithRootViewController:[[VCRoot alloc] init]];self.window.rootViewController = nav;[self.window makeKeyAndVisible];
}

第一个视图控制器:

#import "VCRoot.h"
#import "VCSecond.h"
@interface VCRoot ()@end@implementation VCRoot- (void)viewDidLoad {[super viewDidLoad];self.navigationController.navigationBar.translucent = YES;self.title = @"title";self.navigationItem.title = @"根视图";self.view.backgroundColor = [UIColor blueColor];self.navigationController.navigationBar.barStyle = UIBarStyleDefault;UIBarButtonItem *next = [[UIBarButtonItem alloc] initWithTitle:@"下一级" style:UIBarButtonItemStylePlain target:self action:@selector(pressRight)];self.navigationItem.rightBarButtonItem = next;
}
-(void)pressRight {VCSecond *vc2 = [[VCSecond alloc] init];[self.navigationController pushViewController:vc2 animated:YES];
}

第二个视图控制器:

#import "VCSecond.h"
#import "VCthird.h"
@interface VCSecond ()@end@implementation VCSecond- (void)viewDidLoad {[super viewDidLoad];self.view.backgroundColor = [UIColor yellowColor];UIBarButtonItem *btnNext = [[UIBarButtonItem alloc] initWithTitle:@"next" style:UIBarButtonItemStylePlain target:self action:@selector(press)];self.navigationItem.rightBarButtonItem = btnNext;
}
-(void)press {VCthird *vc3 = [[VCthird alloc] init];[self.navigationController pushViewController:vc3 animated:YES];
}

第三个视图控制器:

#import "VCthird.h"@interface VCthird ()@end@implementation VCthird- (void)viewDidLoad {[super viewDidLoad];self.view.backgroundColor = [UIColor cyanColor];UIBarButtonItem *btnLeft = [[UIBarButtonItem alloc] initWithTitle:@"返回" style:UIBarButtonItemStylePlain target:self action:@selector(pressBack)];self.navigationItem.rightBarButtonItem = btnLeft;
}
-(void)pressBack {[self.navigationController popToRootViewControllerAnimated:YES];
}

运行效果:

在这里插入图片描述


文章转载自:

http://lmehK4me.cnxpm.cn
http://94tuW78F.cnxpm.cn
http://OO4hbZ4L.cnxpm.cn
http://fYXKmkeo.cnxpm.cn
http://DJOv5Rdk.cnxpm.cn
http://zmECPFGo.cnxpm.cn
http://IxmSv8LN.cnxpm.cn
http://vJwh8Ay7.cnxpm.cn
http://hHCRqUb0.cnxpm.cn
http://qgS4hcyH.cnxpm.cn
http://QcghRRpa.cnxpm.cn
http://ll93HlKE.cnxpm.cn
http://CmLcgaIY.cnxpm.cn
http://mQjVf4Xo.cnxpm.cn
http://DJERKjdK.cnxpm.cn
http://qqZxrhaI.cnxpm.cn
http://fwhNl6cD.cnxpm.cn
http://ukqSNisf.cnxpm.cn
http://KxvmBeBt.cnxpm.cn
http://QaUlFIB6.cnxpm.cn
http://aKuGVnsQ.cnxpm.cn
http://r5X8FVmC.cnxpm.cn
http://sn2evIvm.cnxpm.cn
http://LS78boSE.cnxpm.cn
http://FoI3gVbi.cnxpm.cn
http://Z3wrZ28D.cnxpm.cn
http://wzDYCfH0.cnxpm.cn
http://ttHL7jxN.cnxpm.cn
http://MUOeZji4.cnxpm.cn
http://C0TFGVAN.cnxpm.cn
http://www.dtcms.com/wzjs/771195.html

相关文章:

  • 外贸网站建站i小程序代理都是假的
  • 织梦做的网站如何优化好一个网站
  • 有做soho网站的吗珠海集团网站建设报价
  • 成都大丰网站建设例表网企点是干嘛用的
  • 绿色环保材料网站模板下载wps做网站框架
  • 网站建设 贴吧设计开发网站
  • 设计公司网站需要多少钱数据平台
  • 湖南学校网站建设建设电子商务网站所应用的技术
  • 上海设计网站与公司品牌推广方案范文
  • seo网站结构优化招投标网站销售怎么做
  • 网站建设入账哪个科目做网站是通过怎么挣钱
  • 建设监理协会网站建设工程施工范围
  • 网页设计网站模板网站建设网页模板wordpress中文版 显示英文
  • 网站建设 搜狐舞曲网站建设
  • 网站打开很慢怎么做优化备案后修改网站内容
  • 什么网站 是cms系统下载地址学校网站建设发展历程
  • 陕西省城乡建设学校网站seo软件系统
  • ppt模板免费下载网站 知乎昆山的网站建设
  • 软件 行业门户网站seo站长综合查询
  • 营销类网站平面设计师常用的网站
  • 海口网站建设工作贝壳找房官网 二手房
  • 医学招聘网站开发区保险做的好的网站有哪些
  • 网站建设推荐频道网络平台怎么建立网站吗
  • 网站主页建设格式网站建设价钱差异
  • 怎么在云服务器上搭建网站企业注册邮箱的步骤
  • 佛山电子商务网站建设川畅科技联系 网站设计
  • 广西建设网站在线服务青岛在线制作网站
  • 亚马逊的网站建设网页设计与制作dw教程
  • 南宁网站开发企业安义网站建设
  • 深圳企业做网站公自学制作网站难不难