I am checking from my AppDelegate
class whether my ParentEndViewController
is currently the visible class or not.
UIStoryboard *storyboard = [UIStoryboard storyboardWithName:@"MainStoryboard_iPhone" bundle: nil];
ParentEndViewController *parent = [storyboard instantiateViewControllerWithIdentifier:@"ParentEndViewController"];
if (parent.isViewLoaded && parent.view.window){
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:displayName
message:body
delegate:nil
cancelButtonTitle:@"Ok"
otherButtonTitles:nil];
[alertView show];
NSLog(@"current view is parent!");
}
else{
NSLog(@"current view is not parent!");
}
It is printing that current view is not parent!
". But I am sure that the current view running on my app is ParentEndViewController
, i.e it should print current view is parent!
.
Where is the problem?