当前位置:网站首页>Why use weak pointers for delegation- Why use weak pointer for delegation?
Why use weak pointers for delegation- Why use weak pointer for delegation?
2022-07-05 23:26:00 【javail】
problem :
I can't understand why it is correct to define a delegate with weak pointer : I don't understand why it's right to define delegates with weak pointers :
@property (nonatomic,weak) id delegate;
I can't realize why isn't necessary to retain a reference to the delegate... i don't want the object that i use as the delegate to be deallocated... thus, i would prefer using a strong reference not a weak! I don't understand why it's unnecessary to keep references to delegates ... I don't want to release the object used as a delegate ... therefore , I'd rather use strong references than weak ones !
In many cases the delegate is the same object where the instance of my class will be created, in this case creating a weak reference would be a great solution to avoid retain cycle... but what if I choose a totally different object as the delegate ? in many instances , A delegate is an object that will create an instance of a class , under these circumstances , Creating weak references will be a good way to avoid retention periods ... But if I choose a completely different object as a delegate , What should I do ? ?
I searched for other questions on stack overflow but I can't find something that can help me to fully understand this situation. I searched for other issues related to stack overflow , But I can't find any problems that can help me fully understand this situation .
Solution :
Reference resources : https://stackoom.com/en/question/ZRyq边栏推荐
- Three. JS VR house viewing
- Hainan Nuanshen tea recruits warmhearted people: recruitment of the product experience recommender of Nuanshen multi bubble honey orchid single cluster
- The interface of grafana tool displays an error, incluxdb error
- 698. 划分为k个相等的子集 ●●
- How to quickly understand complex businesses and systematically think about problems?
- Realize reverse proxy client IP transparent transmission
- 2.13 summary
- TVS管和ESD管的技術指標和選型指南-嘉立創推薦
- 无刷驱动设计——浅谈MOS驱动电路
- 进击的技术er——自动化
猜你喜欢
LabVIEW打开PNG 图像正常而 Photoshop打开得到全黑的图像
Go language implementation principle -- lock implementation principle
Practice of concurrent search
Scala concurrent programming (II) akka
Douban scoring applet Part-2
CorelDRAW plug-in -- GMS plug-in development -- new project -- macro recording -- VBA editing -- debugging skills -- CDR plug-in (2)
14种神笔记方法,只需选择1招,让你的学习和工作效率提高100倍!
Go语言实现原理——锁实现原理
数据库基础知识(面试)
From the perspective of quantitative genetics, why do you get the bride price when you get married
随机推荐
yate. conf
2022 R2 mobile pressure vessel filling review simulation examination and R2 mobile pressure vessel filling examination questions
Design and implementation of secsha system
Hj16 shopping list
Différence entre hors bande et en bande
Krypton Factor purple book chapter 7 violent solution
Simple and beautiful method of PPT color matching
Brushless drive design -- on MOS drive circuit
Debian 10 installation configuration
2022 G3 boiler water treatment simulation examination and G3 boiler water treatment simulation examination question bank
February 13, 2022 -5- maximum depth of binary tree
帶外和帶內的區別
Go语言实现原理——Map实现原理
2.13 summary
C Primer Plus Chapter 9 question 9 POW function
[Yu Yue education] NC machining technology reference materials of Shaanxi University of science and technology
Calculating the number of daffodils in C language
LeetCode145. Post order traversal of binary tree (three methods of recursion and iteration)
Code farmers to improve productivity
带外和带内的区别