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.

有帮助吗?

解决方案

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]; 
  }
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top