当前位置:网站首页>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边栏推荐
- 开关电源Buck电路CCM及DCM工作模式
- Matlab smooth curve connection scatter diagram
- Solution to the packaging problem of asyncsocket long connecting rod
- 3D point cloud slam
- Krypton Factor purple book chapter 7 violent solution
- Hainan Nuanshen tea recruits warmhearted people: recruitment of the product experience recommender of Nuanshen multi bubble honey orchid single cluster
- Practice of concurrent search
- MySQL (2) -- simple query, conditional query
- Use of grpc interceptor
- Krypton Factor-紫书第七章暴力求解
猜你喜欢
Object detection based on impulse neural network
基于脉冲神经网络的物体检测
Negative sampling
Go语言实现原理——Map实现原理
数学公式截图识别神器Mathpix无限使用教程
LeetCode145. Post order traversal of binary tree (three methods of recursion and iteration)
东南亚电商指南,卖家如何布局东南亚市场?
Neural structured learning - Part 3: training with synthesized graphs
Use of metadata in golang grpc
Expectation, variance and covariance
随机推荐
LeetCode——Add Binary
TVS管 与 稳压二极管参数对比
The PNG image is normal when LabVIEW is opened, and the full black image is obtained when Photoshop is opened
C Primer Plus Chapter 9 question 9 POW function
grafana工具界面显示报错influxDB Error
Différence entre hors bande et en bande
[classical control theory] summary of automatic control experiment
并查集实践
February 13, 2022 -5- maximum depth of binary tree
Registration of Electrical Engineering (elementary) examination in 2022 and the latest analysis of Electrical Engineering (elementary)
Introduction to JVM
ORB_ SLAM2/3
Object detection based on impulse neural network
Technical specifications and model selection guidelines for TVs tubes and ESD tubes - recommended by jialichuang
动态规划 之 打家劫舍
Week 17 homework
2.13 summary
Leetcode sword finger offer brush questions - day 21
698. Divided into k equal subsets ●●
98. Verify the binary search tree ●●