当前位置:网站首页>使用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
边栏推荐
- 最新财报发布+天猫618双榜第一,耐克蓄力领跑下个50年
- Jerry's updated equipment resource document [chapter]
- Dichotomy (integer dichotomy, real dichotomy)
- Stealing others' vulnerability reports and selling them into sidelines, and the vulnerability reward platform gives rise to "insiders"
- MSF horizontal MSF port forwarding + routing table +socks5+proxychains
- 传输层 拥塞控制-慢开始和拥塞避免 快重传 快恢复
- Is it meaningful for 8-bit MCU to run RTOS?
- 2022 Summer Project Training (III)
- 测试123
- Will openeuler last long
猜你喜欢

Grafana 9.0 正式发布!堪称最强!

Smart street lamp based on stm32+ Huawei cloud IOT design

Manifest of SAP ui5 framework json

Distinguish between basic disk and dynamic disk RAID disk redundant array
![Jerry's updated equipment resource document [chapter]](/img/6c/17bd69b34c7b1bae32604977f6bc48.jpg)
Jerry's updated equipment resource document [chapter]

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

FMT open source self driving instrument | FMT middleware: a high real-time distributed log module Mlog

简单易用的PDF转SVG程序

Implementation of queue

2019阿里集群数据集使用总结
随机推荐
HMS core machine learning service creates a new "sound" state of simultaneous interpreting translation, and AI makes international exchanges smoother
2022暑期项目实训(三)
Jielizhi obtains the customized background information corresponding to the specified dial [chapter]
Interview assault 63: how to remove duplication in MySQL?
编译原理——自上而下分析与递归下降分析构造(笔记)
Getting started with pytest ----- test case pre post, firmware
Getting started with pytest ----- test case rules
DNS hijacking
微信为什么使用 SQLite 保存聊天记录?
關於這次通信故障,我想多說幾句…
The latest financial report release + tmall 618 double top, Nike energy leads the next 50 years
adb常用命令
Interview shock 62: what are the precautions for group by?
Top command details
Scratch epidemic isolation and nucleic acid detection Analog Electronics Society graphical programming scratch grade examination level 3 true questions and answers analysis June 2022
Brief description of SQL optimization problems
declval(指导函数返回值范例)
How to solve the error "press any to exit" when deploying multiple easycvr on one server?
Transport layer congestion control - slow start and congestion avoidance, fast retransmission, fast recovery
Transfer data to event object in wechat applet