In Swift ARC is calling deinit when any UIViewController is removing from memory , but it's not getting called if any UIView is removed from memory.
for example
In case of UIViewController Class deinit is working great
class MusicPlayerUIViewController: UIViewController,UITableViewDelegate,UITableViewDataSource
{
deinit
{
APP_DELEGATE.RemovePlayerContents()
}
}
but in case of UIView Class deinit not working
class MusicPlayerView: UIView,UITableViewDelegate,UITableViewDataSource
{
deinit
{
APP_DELEGATE.RemovePlayerContents()
}
}
any idea .
Parent ViewController can hold you UIView. You have to set to nil a property, that stored you UIView in parent UIViewController for release uiview.
Or override removeFromSuperview() and place your deinit code in it.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With