当前位置:网站首页>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边栏推荐
- 芯源&立创EDA训练营——无刷电机驱动
- 98. 验证二叉搜索树 ●●
- Alibaba Tianchi SQL training camp task4 learning notes
- Data analysis - Thinking foreshadowing
- Southeast Asia e-commerce guide, how do sellers layout the Southeast Asia market?
- How to design API return code (error code)?
- 11gR2 Database Services for " Policy" and " Administrator" Managed databases (file I
- Getting started stm32--gpio (running lantern) (nanny level)
- 开关电源Buck电路CCM及DCM工作模式
- UVA – 11637 Garbage Remembering Exam (组合+可能性)
猜你喜欢

动态规划 之 打家劫舍

东南亚电商指南,卖家如何布局东南亚市场?

Matlab smooth curve connection scatter diagram

698. Divided into k equal subsets ●●

Using LNMP to build WordPress sites

698. 划分为k个相等的子集 ●●

进击的技术er——自动化

Neural structured learning 4 antagonistic learning for image classification

Debian 10 installation configuration

Xinyuan & Lichuang EDA training camp - brushless motor drive
随机推荐
CJ mccullem autograph: to dear Portland
二叉树递归套路总结
Neural structured learning - Part 2: training with natural graphs
2022.6.20-6.26 AI行业周刊(第103期):新的小生命
698. 划分为k个相等的子集 ●●
Summary of binary tree recursive routines
Week 17 homework
无刷驱动设计——浅谈MOS驱动电路
Using LNMP to build WordPress sites
Three. JS VR house viewing
Alibaba Tianchi SQL training camp task4 learning notes
Déterminer si un arbre binaire est un arbre binaire complet
LeetCode102. Sequence traversal of binary tree (output by layer and unified output)
The maximum happiness of the party
两数之和、三数之和(排序+双指针)
UVA – 11637 Garbage Remembering Exam (组合+可能性)
poj 2762 Going from u to v or from v to u? (推断它是否是一个薄弱环节图)
Live tiktok shop 2022 latest gameplay card slot overseas live e-commerce new traffic
(4)UART应用设计及仿真验证2 —— TX模块设计(无状态机)
(4)UART应用设计及仿真验证2 —— RX模块设计(无状态机)