0

I have to hide a button by checking two particular viewcontroller's view is a descendant of present view.This is being done when the app comes to foreground. Code:

 [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(applicationWillEnterForeground) name:UIApplicationWillEnterForegroundNotification object:nil] ;


(void)applicationWillEnterForeground
{
   if(!([hrViewController.view isDescendantOfView:self.view] || [reportViewController.view isDescendantOfView:self.view]))

{
[self.theFavouriteButton setHidden:YES];
}

}

And the problem is ,Eventhough the view presented while coming to foreground is hrViewController.view or reportViewController.view,the control is reaching inside the if condition and which is hiding my button.Why is this so?

Wain
  • 118,658
  • 15
  • 128
  • 151
Vork
  • 746
  • 2
  • 12
  • 34

0 Answers0