This question is related to a previous question of mine to which I couldn't get an answer, but I think I am getting closer.
I have a UIView
, that is added to an NSMutableArray
. Later I add that UIView
as a subview of another view, but without removing it from the array . Does this mean that my UIView
is no longer an item in my array?
In other words, does the -addSubview
method automatically remove my UIView
object from the NSMutableArray
?
No it doesn't. Your array and the superview to which you added the UIView will retain the view. That's all.
This can become a bit nasty if your UIView is unloaded due to a memory warning but is still in memory because of your array still retaining the instance.
No it does not. You have to explicitly remove it if you want it gone.
不,它应该仍然在数组内部。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.