1

I am building a custom control, in which I want to register control (subclass of UIButton) for notification when it is loaded, and unregister when UIView is unloaded.

I have searched a lot, and found numerous methods for UIViewController's life cycle but not for simple UIView.Can you provide methods when I can determine start and end of UIView

Muhammad Nabeel Arif
  • 19,140
  • 8
  • 51
  • 70

1 Answers1

1

What about registering for notifications when the control is created (with initWithFrame and initWithCoder) and deregistering when the control is destructed (in dealloc). You can then check for self.window at every notification to see if the control is visible.

gabriel_101
  • 773
  • 3
  • 19