문제

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