简体   繁体   中英

How do I release self (UIImageView) in touchesEnded?

I have an object that is a child of UIImageView. Before all these touches methods, I add this object to the superview and then user moves it. In touchesEnded, sometimes I want to release self. I've tried:

- [self release]

or

- [self removeFromSuperview]

But all these tries end up in exceptions. What's the right way to release self?

You cannot release self. self is main view and if you want to remove object from UIImageView then you have to remove it using that object name. [objNameSubViewOFUIImageView removeFromSuperview]

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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM