I am creating an app with tab bar. I want a login screen to appear before tab bar if the user is not logged in. So I connected the tab bar controller with the login view controller using segue.
I am running this code in tab bar controller:
-(void)viewDidAppear:(BOOL)animated{
if([user isEqualToString:@""] || user==nil){
[self performSegueWithIdentifier:@"toLoginVC" sender:self];
}
but the tab bar is appear and then the view. I tried to use the viewWillAppear but I am getting an error? Any ides how to create the login screen?
More information would be useful, but judging by your description, I would change some settings in your segue.
First, I assume you have a modal segue that covers the whole screen, including the tab bar. If not, you should change your segue to modal, as this is the "proper" abstraction for a login screen like you are describing.
Second, if you uncheck the "Animates" box in the attributes inspector, it should appear right away.