ios - How Do I Dismiss My Login View For Good? -
so far have gotten login view appear @ at start of app using method in viewdidappear in first view controller, once username , password gets approved web service, 1st view controller appears split second , goes login view.
am forgetting something??? did coding in login view, , 1st view.
coding 1st :
 - (void)viewdidappear:(bool)animated {     [super viewdidappear:animated];      uistoryboard *storyboard = [uistoryboard storyboardwithname:@"mainstoryboard" bundle:nil];     uiviewcontroller *vc = [storyboard instantiateviewcontrollerwithidentifier:@"loginviewcontroller"];     [vc setmodalpresentationstyle:uimodalpresentationfullscreen];      [self presentmodalviewcontroller:vc animated:yes];     [self dismissmodalviewcontrolleranimated:yes];  }   heres coding in loginview
    - (void)parser:(nsxmlparser *)parser didendelement:(nsstring *)elementname    namespaceuri:(nsstring *)namespaceuri qualifiedname:(nsstring *)qname  {      nsmutablestring *yes =[[nsmutablestring alloc] initwithstring:@"y"];      if ([ capturedcharacters isequaltostring:yes])     {             //[self presentmodalviewcontroller:vc animated:yes];          [self dismissmodalviewcontrolleranimated:yes];       }     else     {         // ask user login again,      }     [capturedcharacters release];     capturedcharacters = nil;      if ([elementname isequaltostring:@"str_partinfo"]) {         // no longer in item element         initemelement = no;      } }   and i'm using tab bar template
by calling:
 - (void)viewdidappear:(bool)animated   you're presenting loginview every single time parent view controller comes view. think what's happening when login view gets dismissed, "viewdidappear" fires calls login view again.
try putting logic inside -(void)viewdidload , see if trick:
  - (void)viewdidload  {      [super viewdidload];       uistoryboard *storyboard = [uistoryboard storyboardwithname:@"mainstoryboard" bundle:nil];      uiviewcontroller *vc = [storyboard instantiateviewcontrollerwithidentifier:@"loginviewcontroller"];      [vc setmodalpresentationstyle:uimodalpresentationfullscreen];       [self presentmodalviewcontroller:vc animated:yes];      [self dismissmodalviewcontrolleranimated:yes];   }    alternatively, can have bool pointer, pseudocode:
 bool loginsuccessful;  if(!loginsuccessful)  {       //showlogin       loginsuccessful = true;   }      
Comments
Post a Comment