So i am using a Navigation controller to handle two view controllers. One is ItemsViewController that is the root view controller of the NavController.
The second controller named DetailViewController is pushed on top of ItemsViewController. This way i've made a drill-down UI using these 2 controllers. Now inside DetailViewController i've added a couple of subviews like buttons, textfields, labels and an imageView
.
The imageView
pointer that is declared inside of DetailViewController is of type 'weak', so whenever the view controller's main view is cleared off, the old imageView object doesn't hang around. But in reality i'm observing this behaviour.
What happens is, when i go back from DetailViewController's view to ItemsViewController's table view, the former is loaded off the parent-child controller stack so that when i re-enter the DetailViewController's view (same one as before),it is reloaded and thus recreating a UIView all over again.
Thus the new UIView has got all the new subview objects created. But (and this is the problem), the old image object in the new imageView
object is still there. This is confusing me. Could someone clear this up?
在ViewWillDisappear
设置UIImageView如下所示,可以解决您的问题
imageView.image = nil
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.