ipad - Manual segue not transitioning properly -
i new ios i've been able muddle though... until now. have application login page. first thing did create few empty view controllers , stuck them on storyboard. have loginviewcontroller text fields userid , password plus login button. plan if log in brought tabviewcontroller. right out of box. deleted 2 view controllers got created , replaced them 2 navigationcontrollers.
just test made segue login button tabviewcontroller. worked fine. views came up. out of box stuff worked.
next step tried simulate actual login. since have through web service call figured needed asynchronous. deleted initial segue added login button , added ibaction button loginviewcontroller. added manual segue loginviewcontroller tabviewcontroller , named "loginsegue"
here code have far:
- (ibaction)login:(id)sender { [decorator showviewbusyin:self.aview scale:1.5 makewhite:no]; self.clientidtext.enabled = no; self.useridtext.enabled = no; self.passwordtext.enabled = no; uibutton* loginbtn = sender; loginbtn.enabled = no; [decorator showviewbusyin:self.aview scale:2.0 makewhite:no]; self.operation = [[nsinvocationoperation alloc] initwithtarget:self selector:@selector(dologin) object:nil]; self.queue = [[nsoperationqueue alloc] init]; [self.queue addoperation:self.operation]; } -(void)dologin{ [nsthread sleepfortimeinterval:1]; [decorator removebusyindicatorfrom:self.aview]; // put login code... [self performseguewithidentifier:@"loginsegue" sender:self]; }
i put call sleepfortimeinterval simulate waiting web service call complete. remove later. decorator stuff shows , removes activity indicator view.
when segue works view associated login view controller remains on screen. put way, tabviewcontroller shows up. first item selected. navigationcontroller shows vc associated , view contains not appear. view loginviewcontroller stays there.
since navigation worked fine when put segue on login button i'm thinking has invocation operation. either or somehow view or view controller hierarchy getting messed up.
any ideas i'm doing wrong? way login?
any appreciated, nat
for kind of operation, using gcd can easier. like:
- (void)dologin { dispatch_queue_t loginqueue = dispatch_queue_create(“login”, null); dispatch_async(loginqueue, ^{ // put login code... dispatch_async(dispatch_get_main_queue(), ^{ [decorator removebusyindicatorfrom:self.aview]; [self performseguewithidentifier:@"loginsegue" sender:self]; }); }); }
and in -(ibaction)login:(id)sender
call [self dologin]
instead of
self.operation = [[nsinvocationoperation alloc] initwithtarget:self selector:@selector(dologin) object:nil]; self.queue = [[nsoperationqueue alloc] init]; [self.queue addoperation:self.operation];
check question, briefly explains main differences between gcd , nsoperationqueue
Comments
Post a Comment