I do not understand why UIView removeFromSuperviewcalls didMoveToSuperview.
I think that didMoveToSuperviewis called only when the view is added to the view. Can someone explain this why it removeFromSuperviewcauses didMoveToSuperview?
Here is what I do in removeFromSuperview:
public override func removeFromSuperview() {
clearDelegates()
chaosPad?.removeFromSuperview()
brushSliders?.removeFromSuperview()
moodSlider?.removeFromSuperview()
brushShapeMenu?.removeFromSuperview()
moodMenu?.removeFromSuperview()
gravityMenu?.removeFromSuperview()
rotationMenu?.removeFromSuperview()
menuGroups = []
centerButtons = []
scrollMenuItems = []
menu?.removeFromSuperview()
menu = nil
super.removeFromSuperview()
}
func clearDelegates() {
chaosPad?.delegate = nil
viewController = nil
}
Here is the call stack showing how it is called didMoveToSuperview:
#0 0x0000000110f39708 in specialized _fatalErrorMessage(StaticString, StaticString, StaticString, UInt) -> () ()
#1 0x000000010b9cb960 in TDTOilistMenuPainting.configureFrames() -> () at /FastDev/TDTPhotoLib/Oilist/Classes/TDTOilistMenuPainting.swift:161
#2 0x000000010b9cb83e in TDTOilistMenuPainting.didMoveToSuperview() -> () at /FastDev/TDTPhotoLib/Oilist/Classes/TDTOilistMenuPainting.swift:146
#3 0x000000010b9cb872 in @objc TDTOilistMenuPainting.didMoveToSuperview() -> () ()
#4 0x000000010f5d1db5 in __45-[UIView(Hierarchy) _postMovedFromSuperview:]_block_invoke ()
#5 0x000000010dc87c60 in -[NSISEngine withBehaviors:performModifications:] ()
#6 0x000000010f5d19b1 in -[UIView(Hierarchy) _postMovedFromSuperview:] ()
#7 0x000000010f5cf610 in __UIViewWasRemovedFromSuperview ()
#8 0x000000010f5cf107 in -[UIView(Hierarchy) removeFromSuperview] ()
#9 0x000000010b9c9aba in TDTOilistMenuPainting.removeFromSuperview() -> () at /FastDev/TDTPhotoLib/Oilist/Classes/TDTOilistMenuPainting.swift:73
#10 0x000000010ba6d269 in TDTPaintingViewController.(navigationController(UINavigationController, animationControllerForOperation : UINavigationControllerOperation, fromViewController : UIViewController, toViewController : UIViewController) -> UIViewControllerAnimatedTransitioning?).(closure
source
share