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

手机做网站多少钱qq群推广链接

手机做网站多少钱,qq群推广链接,武汉网络推广公司哪家好,建设银行e卡通官方网站界面切换 push和poppresent和dismiss示例程序 push和pop 在 Objective-C 中,pop 和 push 通常是与 UINavigationController 一起使用的方法,用于控制导航栈中视图控制器的跳转和回退。 push 和 pop 通常成对使用,用于实现导航栈的前进和后退功能。当用户进入新的视图控制器时…

界面切换

  • push和pop
  • present和dismiss
  • 示例程序

push和pop

在 Objective-C 中,pop 和 push 通常是与 UINavigationController 一起使用的方法,用于控制导航栈中视图控制器的跳转和回退。

  • push 和 pop 通常成对使用,用于实现导航栈的前进和后退功能。
  • 当用户进入新的视图控制器时,使用 push 方法将其加入导航栈;
  • 当用户需要返回上一个视图控制器时,使用 pop 方法从导航栈中移除当前视图控制器。

push的代码格式:

[self.navigationController pushViewController:two animated:YES];

pop的代码格式

//返回上一视图控制器
[self.navigationController popViewControllerAnimated:YES];
//返回根视图控制器
[self.navigationController popToRootViewControllerAnimated:YES];
//返回到指定的控制器
[self.navigationController popToViewController:one animated:YES];

present和dismiss

在 Objective-C 中,present 和 dismiss 是与视图控制器相关的两个重要概念,它们描述了视图控制器的呈现和关闭行为。present 用于以模态方式呈现一个新的视图控制器。dismiss 用于关闭当前模态呈现的视图控制器,返回到上一级视图控制器。

区别与联系:

  • present 和 dismiss 是相对的概念,present 用于呈现新的视图控制器,dismiss 用于关闭当前视图控制器。
  • 通常情况下,一个视图控制器被 present 之后,需要通过 dismiss 方法来关闭自己,返回到上一级视图控制器。

示例代码:

[self presentViewController:three animated:YES completion:nil];
[self dismissViewControllerAnimated:YES completion:nil];

示例程序

在这里插入图片描述
VCone.m:

#import "VCone.h"
#import "VCtwo.h"
@interface VCone ()@end@implementation VCone
@synthesize item = _item;
- (void)viewDidLoad {[super viewDidLoad];self.view.backgroundColor = [UIColor redColor];_item = [[UIBarButtonItem alloc] initWithTitle:@"下一页" style:UIBarButtonItemStylePlain target:self action:@selector(pressRight)];self.navigationItem.rightBarButtonItem = _item;
}-(void) pressRight
{VCtwo* two = [[VCtwo alloc] init];[self.navigationController pushViewController:two animated:YES];}/*
#pragma mark - Navigation// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {// Get the new view controller using [segue destinationViewController].// Pass the selected object to the new view controller.
}
*/@end

VCtwo.m:

#import "VCtwo.h"
#import "VCone.h"
#import "VCthree.h"
@interface VCtwo ()@end@implementation VCtwo
@synthesize btn = _btn;
@synthesize btn1 = _btn1;
- (void)viewDidLoad {[super viewDidLoad];self.view.backgroundColor = [UIColor greenColor];_btn = [[UIBarButtonItem alloc] initWithTitle:@"上一页" style:UIBarButtonItemStylePlain target:self action:@selector(press)];self.navigationItem.leftBarButtonItem = _btn;_btn1 = [[UIBarButtonItem alloc] initWithTitle:@"下一页" style:UIBarButtonItemStylePlain target:self action:@selector(pressright)];self.navigationItem.rightBarButtonItem = _btn1;
}-(void) press
{[self.navigationController popViewControllerAnimated:YES];
}-(void) pressright
{VCthree* three = [[VCthree alloc] init];[self presentViewController:three animated:YES completion:nil];
}/*
#pragma mark - Navigation// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {// Get the new view controller using [segue destinationViewController].// Pass the selected object to the new view controller.
}
*/@end

VCthree.m:

#import "VCthree.h"
#import "VCtwo.h"
@interface VCthree ()@end@implementation VCthree- (void)viewDidLoad {[super viewDidLoad];// Do any additional setup after loading the view.self.view.backgroundColor = [UIColor yellowColor];
}-(void) touchesBegan:(NSSet<UITouch *> *)touches withEvent:(UIEvent *)event
{[self dismissViewControllerAnimated:YES completion:nil];
}/*
#pragma mark - Navigation// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {// Get the new view controller using [segue destinationViewController].// Pass the selected object to the new view controller.
}
*/@end

效果图

在这里插入图片描述

http://www.khdw.cn/news/4458.html

相关文章:

  • 章丘做网站优化百度一下网页入口
  • 沧州做网站价格广东短视频seo营销
  • 南山品牌网站建设企业站长工具使用方法
  • 无锡谁会建商务网站黄冈网站推广软件免费下载
  • 无障碍网站建设的摘要直接进入网站的代码
  • 个人网站可以做地方免费的网络推广渠道
  • 贵阳网站建设平台百度免费咨询
  • 深圳有多少家设计公司企业seo培训
  • 做网站运营有前途seo搜索引擎优化实战
  • 做建筑看那些网站百度竞价平台官网
  • 网站建设一般用什么语言seo收费还是免费
  • 高端网站建设案例网络营销与管理专业是干什么的
  • 做外贸比较好用的网站seo关键词找29火星软件
  • 北京网站seo百度投诉中心
  • 个人做网站有什么用网站查询信息
  • phpcms双语网站怎么做肇庆seo优化
  • wordpress 快讯模板重庆seo网站运营
  • 嵌入式软件开发面试题内江seo
  • 如何创做网站百度风云榜排行榜
  • 网页设计建网站流程人力资源和社会保障部
  • 四平网站建设公司网站seo运营
  • 建设银行网站修改网盘资源共享网站
  • 马蜂窝是什么做的网站怎么让百度收录自己的网站
  • 网站设计一般要求google移动服务应用优化
  • 护士资格注册网站百度网游排行榜
  • 盗用别的公司网站模块windows优化大师卸载不了
  • 做网赌需要在哪些网站投广告个人博客登录首页
  • 网站建设课程设计实训报告传统营销方式有哪些
  • 武汉做网站优化的公司市场营销策划书
  • 北海 做网站 英文网址域名注册信息查询