ios - hide a button on checking a condition while the app enters foreground -


i have hide button checking 2 particular viewcontroller's view descendant of present view.this being done when app comes 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 problem ,eventhough view presented while coming foreground hrviewcontroller.view or reportviewcontroller.view,the control reaching inside if condition , hiding button.why so?


Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -