I just put my logic here:
Take/add one viewController such like, DummyViewController
as rootViewController
of your app.
in the DummyViewController's
viewWillAppear
method put logic like a
- (void)viewWillAppear:(BOOL)animated
{
[super viewWillAppear:animated];
if(login == YES)
{
//go to home screen
}
else
{
// go to login screen
}
}
In DummyViewController
you just need to write code in viewWillAppear
not anymore.
If you want to Logout then just call
[self.navigationController popToRootViewControllerAnimated:YES];
And viewWillAppear
method of DummyViewController
will manage your screen based on login status.