当前位置:网站首页>使用block实现两个页面之间的传统价值观
使用block实现两个页面之间的传统价值观
2022-07-06 10:18:00 【全栈程序员站长】
大家好,又见面了,我是全栈君。
第二个view声明一个block属性:
@property (nonatomic, copy) void(^doTransferMsg)(NSString *_msg);
然后传值方法里检查block是不是存在
– (IBAction)transferText:(UIButton *)sender { if (_doTransferMsg) { _doTransferMsg(@”hello there”); _doTransferMsg = nil; } [self.navigationController popViewControllerAnimated:YES]; }
主View里。创建第二个view的时候。顺便实现这个block
– (IBAction)LoadDetailView:(UIButton *)sender { [ibTextLabel setText:nil]; DetailViewController *_curDetail = [[DetailViewController alloc] initWithNibName:@”DetailViewController” bundle:nil]; [_curDetail setDoTransferMsg:^(NSString *_msg) { dispatch_async(dispatch_get_main_queue(), ^{ [ibTextLabel setText:_msg]; }); }]; [self.navigationController pushViewController:_curDetail animated:YES]; [_curDetail release]; }
that’s all
版权声明:本文博客原创文章,博客,未经同意,不得转载。
发布者:全栈程序员栈长,转载请注明出处:https://javaforall.cn/117387.html原文链接:https://javaforall.cn
边栏推荐
- SQL优化问题的简述
- 二分(整数二分、实数二分)
- 2022 Summer Project Training (III)
- MSF horizontal MSF port forwarding + routing table +socks5+proxychains
- This article discusses the memory layout of objects in the JVM, as well as the principle and application of memory alignment and compression pointer
- Five data structures of redis
- 李書福為何要親自掛帥造手機?
- 78 year old professor Huake has been chasing dreams for 40 years, and the domestic database reaches dreams to sprint for IPO
- Virtual machine VirtualBox and vagrant installation
- 带你穿越古罗马,元宇宙巴士来啦 #Invisible Cities
猜你喜欢

简单易用的PDF转SVG程序

Is it meaningful for 8-bit MCU to run RTOS?

F200 - UAV equipped with domestic open source flight control system based on Model Design

Smart street lamp based on stm32+ Huawei cloud IOT design

Virtual machine VirtualBox and vagrant installation

Compilation principle - top-down analysis and recursive descent analysis construction (notes)

The third season of Baidu online AI competition is coming in midsummer, looking for you who love AI!

Pourquoi Li shufu a - t - il construit son téléphone portable?

关于这次通信故障,我想多说几句…

【Android】Kotlin代码编写规范化文档
随机推荐
J'aimerais dire quelques mots de plus sur ce problème de communication...
阿里云国际版ECS云服务器无法登录宝塔面板控制台
最新财报发布+天猫618双榜第一,耐克蓄力领跑下个50年
Getting started with pytest ----- test case pre post, firmware
第三季百度网盘AI大赛盛夏来袭,寻找热爱AI的你!
C语言指针*p++、*(p++)、*++p、*(++p)、(*p)++、++(*p)对比实例
Top command details
Stealing others' vulnerability reports and selling them into sidelines, and the vulnerability reward platform gives rise to "insiders"
STM32 key state machine 2 - state simplification and long press function addition
d绑定函数
F200——搭载基于模型设计的国产开源飞控系统无人机
传输层 拥塞控制-慢开始和拥塞避免 快重传 快恢复
2019 Alibaba cluster dataset Usage Summary
Prophet模型的简介以及案例分析
Transport layer congestion control - slow start and congestion avoidance, fast retransmission, fast recovery
Ms-tct: INRIA & SBU proposed a multi-scale time transformer for motion detection. The effect is SOTA! Open source! (CVPR2022)...
Compilation Principle -- C language implementation of prediction table
Wchars, coding, standards and portability - wchars, encodings, standards and portability
UDP协议:因性善而简单,难免碰到“城会玩”
Maixll-Dock 摄像头使用