当前位置:网站首页>使用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
边栏推荐
- Video fusion cloud platform easycvr adds multi-level grouping, which can flexibly manage access devices
- win10系统下插入U盘有声音提示却不显示盘符
- Excellent open source fonts for programmers
- Transfer data to event object in wechat applet
- 【剑指 Offer】 60. n个骰子的点数
- Scratch epidemic isolation and nucleic acid detection Analog Electronics Society graphical programming scratch grade examination level 3 true questions and answers analysis June 2022
- MarkDown语法——更好地写博客
- MSF horizontal MSF port forwarding + routing table +socks5+proxychains
- 2022 Summer Project Training (I)
- Kivy tutorial: support Chinese in Kivy to build cross platform applications (tutorial includes source code)
猜你喜欢
[Android] kotlin code writing standardization document
On time and parameter selection of asemi rectifier bridge db207
Today in history: the mother of Google was born; Two Turing Award pioneers born on the same day
UDP protocol: simple because of good nature, it is inevitable to encounter "city can play"
Rb157-asemi rectifier bridge RB157
30 minutes to understand PCA principal component analysis
[.Net core] solution to error reporting due to too long request length
30 分钟看懂 PCA 主成分分析
Declval (example of return value of guidance function)
Excellent open source fonts for programmers
随机推荐
最新财报发布+天猫618双榜第一,耐克蓄力领跑下个50年
2019 Alibaba cluster dataset Usage Summary
Excel usage record
OpenEuler 会长久吗
On time and parameter selection of asemi rectifier bridge db207
Insert dial file of Jerry's watch [chapter]
30 分钟看懂 PCA 主成分分析
STM32+ESP8266+MQTT协议连接OneNet物联网平台
Heavy! Ant open source trusted privacy computing framework "argot", flexible assembly of mainstream technologies, developer friendly layered design
Is it meaningful for 8-bit MCU to run RTOS?
declval(指导函数返回值范例)
30 minutes to understand PCA principal component analysis
递归的方式
Appium automated test scroll and drag_ and_ Drop slides according to element position
Introduction to the usage of model view delegate principal-agent mechanism in QT
2022 Summer Project Training (III)
UDP协议:因性善而简单,难免碰到“城会玩”
Take you through ancient Rome, the meta universe bus is coming # Invisible Cities
F200——搭载基于模型设计的国产开源飞控系统无人机
Brief description of SQL optimization problems