Strange behavior with a button next to the notification center on the iPad

I have a UIButton (back button) in the upper left corner of the iPad app that rejects the view controller. I found that if you press this button a little too high, you can activate the button and start removing the notification bar at the same time. When this happens, my -viewWillDisappear runs and stops the animation in the view, but the view is not actually rejected. Of course, the notification bar does not completely disappear, so the clean result looks like my animation crashed, and that the back button also failed.

The obvious solution would be to move the button a bit, but since this is undesirable for layouts, I wonder if:

  • Has anyone ever seen this behavior before.
  • If this is a well-defined behavior, and if so, where is Apple describing it.
  • Are there any known ways to work?

EDIT: Actually, it seems the least problem. Turns out this is my -applicationWillResignActive that -applicationWillResignActive called, not -viewWillDisappear . It still looks bad, but at least the behavior is well defined. I don’t activate my home button at all by simply removing the notification bar.

+7
ios objective-c ipad
source share
1 answer

I made a UIViewController that has a timed animation (like an ad) and pushing the notification bar down doesn't stop it until the bar is fully expanded.

You may have to deal with animations on -applicationWillResignActive: and -applicationDidBecomeActive: for example, pause and resume them.

You can receive these notifications directly on your UIViewController (instead of dealing with them on your AppDelegate) by adding the following code to your -viewDidLoad :

 // Add observers [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(pauseAnimations:) name: UIApplicationWillResignActiveNotification object:nil]; [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(resumeAnimations:) name:UIApplicationDidBecomeActiveNotification object:nil]; 
+1
source share

All Articles