Added check to make sure that the superview is not nil. -didMoveToSuperview will be called when self.superview is assigned nil.