Domanda

I want to open after login page if user is already logged in but if the user is not logged in then only open the login page for this I used NSUser default and it works only if the user single click on tab bar and if user double clicks on tab bar then it opens login page as I connect login page to tab bar.so how can I open every time "after login page" if user is already logged in either user clicks single or multiple clicks on tab bar button.

È stato utile?

Soluzione

ModyFiy it according to You........ ... Save Bool Type Variable for Login Status In Yor Login View Controller....

-(void)viewWillAppear:(BOOL)animated
  {

      BOOL isLogin=[[NSUserDefaults standardUserDefaults]boolForKey:@"LoginUser"];
   if (isLogin==YES)
     {
        [logoutBtn removeTarget:self action:@selector(loginAndRegister) forControlEvents:UIControlEventTouchUpInside];

        [logoutBtn addTarget:self action:@selector(logout) forControlEvents:UIControlEventTouchUpInside];


      }
   else
    {
       [logoutBtn removeTarget:self action:@selector(logout) forControlEvents:UIControlEventTouchUpInside];
       [logoutBtn addTarget:self action:@selector(loginAndRegister) forControlEvents:UIControlEventTouchUpInside];

     }

     [self willAnimateRotationToInterfaceOrientation:[UIApplication sharedApplication].statusBarOrientation duration:1.0]; 
  }
Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top