当前位置:网站首页>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边栏推荐
- 2022.6.20-6.26 AI行业周刊(第103期):新的小生命
- 数学公式截图识别神器Mathpix无限使用教程
- There are 14 God note taking methods. Just choose one move to improve your learning and work efficiency by 100 times!
- Summary of binary tree recursive routines
- golang代码检查工具
- npm ELECTRON_ Mirror is set as domestic source (npmmirror China mirror)
- idea 连接mysql ,直接贴配置文件的url 比较方便
- C Primer Plus Chapter 9 question 9 POW function
- TVS管和ESD管的技術指標和選型指南-嘉立創推薦
- Calculating the number of daffodils in C language
猜你喜欢
Creative mode 1 - single case mode
Commonly used probability distributions: Bernoulli distribution, binomial distribution, polynomial distribution, Gaussian distribution, exponential distribution, Laplace distribution and Dirac delta d
2022 R2 mobile pressure vessel filling review simulation examination and R2 mobile pressure vessel filling examination questions
LeetCode102. Sequence traversal of binary tree (output by layer and unified output)
How to design API return code (error code)?
Use of metadata in golang grpc
LeetCode145. Post order traversal of binary tree (three methods of recursion and iteration)
动态规划 之 打家劫舍
Basic knowledge of database (interview)
开关电源Buck电路CCM及DCM工作模式
随机推荐
98. Verify the binary search tree ●●
Object detection based on impulse neural network
Judge whether the binary tree is a complete binary tree
TypeError: this. getOptions is not a function
VS2010 writes DLL and unit test of dynamic link library, and transfers the correctness of DLL test
2022 G3 boiler water treatment simulation examination and G3 boiler water treatment simulation examination question bank
CorelDRAW plug-in -- GMS plug-in development -- new project -- macro recording -- VBA editing -- debugging skills -- CDR plug-in (2)
Non rigid / flexible point cloud ICP registration
UVA – 11637 Garbage Remembering Exam (组合+可能性)
Dynamic planning: robbing families and houses
npm ELECTRON_ Mirror is set as domestic source (npmmirror China mirror)
Media query: importing resources
grafana工具界面显示报错influxDB Error
东南亚电商指南,卖家如何布局东南亚市场?
Code farmers to improve productivity
CIS benchmark tool Kube bench
February 13, 2022-4-symmetric binary tree
Commonly used probability distributions: Bernoulli distribution, binomial distribution, polynomial distribution, Gaussian distribution, exponential distribution, Laplace distribution and Dirac delta d
Practice of concurrent search
Development specification: interface unified return value format [resend]