当前位置:网站首页>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边栏推荐
- Introduction to JVM
- [original] what is the core of programmer team management?
- When to use useImperativeHandle, useLayoutEffect, and useDebugValue
- Hj16 shopping list
- 帶外和帶內的區別
- 3D reconstruction of point cloud
- UVA – 11637 Garbage Remembering Exam (组合+可能性)
- (4)UART应用设计及仿真验证2 —— RX模块设计(无状态机)
- LabVIEW打开PNG 图像正常而 Photoshop打开得到全黑的图像
- JVM的简介
猜你喜欢

YML configuration, binding and injection, verification, unit of bean

《牛客刷verilog》Part III Verilog企业真题

Brushless drive design -- on MOS drive circuit

基于脉冲神经网络的物体检测

698. Divided into k equal subsets ●●

数据库基础知识(面试)

There are 14 God note taking methods. Just choose one move to improve your learning and work efficiency by 100 times!

Sum of two numbers, sum of three numbers (sort + double pointer)

Use of grpc interceptor

东南亚电商指南,卖家如何布局东南亚市场?
随机推荐
C Primer Plus Chapter 9 question 9 POW function
Xinyuan & Lichuang EDA training camp - brushless motor drive
Go language implementation principle -- map implementation principle
The maximum happiness of the party
芯源&立创EDA训练营——无刷电机驱动
【原创】程序员团队管理的核心是什么?
Data analysis - Thinking foreshadowing
(4)UART应用设计及仿真验证2 —— RX模块设计(无状态机)
Using LNMP to build WordPress sites
Leetcode sword finger offer brush questions - day 21
LabVIEW打开PNG 图像正常而 Photoshop打开得到全黑的图像
Initial experience | purchase and activate typora software
poj 2762 Going from u to v or from v to u? (推断它是否是一个薄弱环节图)
Data type, variable declaration, global variable and i/o mapping of PLC programming basis (CoDeSys)
LeetCode102. Sequence traversal of binary tree (output by layer and unified output)
Code farmers to improve productivity
Design and implementation of secsha system
2022 R2 mobile pressure vessel filling review simulation examination and R2 mobile pressure vessel filling examination questions
两数之和、三数之和(排序+双指针)
VS2010 writes DLL and unit test of dynamic link library, and transfers the correctness of DLL test