当前位置:网站首页>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边栏推荐
- 帶外和帶內的區別
- VS2010 writes DLL and unit test of dynamic link library, and transfers the correctness of DLL test
- Negative sampling
- Marginal probability and conditional probability
- 视频标准二三事
- Media query: importing resources
- Detailed explanation of pointer and array written test of C language
- asp. Net pop-up layer instance
- 2022 R2 mobile pressure vessel filling review simulation examination and R2 mobile pressure vessel filling examination questions
- How to enable relationship view in phpMyAdmin - how to enable relationship view in phpMyAdmin
猜你喜欢

CorelDRAW plug-in -- GMS plug-in development -- new project -- macro recording -- VBA editing -- debugging skills -- CDR plug-in (2)

Initial experience | purchase and activate typora software

TVS管 与 稳压二极管参数对比

Attacking technology Er - Automation

《牛客刷verilog》Part III Verilog企业真题
![Development specification: interface unified return value format [resend]](/img/3e/8751b818147cabbe22e4ce44af7d24.jpg)
Development specification: interface unified return value format [resend]

进击的技术er——自动化

CIS benchmark tool Kube bench

February 13, 2022-4-symmetric binary tree

Data analysis - Thinking foreshadowing
随机推荐
[original] what is the core of programmer team management?
Use of shell:for loop
帶外和帶內的區別
《牛客刷verilog》Part III Verilog企业真题
698. Divided into k equal subsets ●●
开关电源Buck电路CCM及DCM工作模式
npm ELECTRON_ Mirror is set as domestic source (npmmirror China mirror)
芯源&立创EDA训练营——无刷电机驱动
[Yu Yue education] NC machining technology reference materials of Shaanxi University of science and technology
Debian 10 installation configuration
C Primer Plus Chapter 9 question 9 POW function
Use of grpc interceptor
February 13, 2022-4-symmetric binary tree
Media query: importing resources
Alibaba Tianchi SQL training camp task4 learning notes
Matlab smooth curve connection scatter diagram
asp. Net pop-up layer instance
Go language implementation principle -- lock implementation principle
Krypton Factor-紫书第七章暴力求解
Solution to the packaging problem of asyncsocket long connecting rod