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
Post a Comment