iphone - one view controller appears on another view controller in iOS 5 and below versions -


i have uitabbarcontroller 2 view controllers. when click on login button present in 1 view controller, should take me other tabbarcontroller. when happens first view controller on top of present tabbarcontroller , looks 1 on other. works fine in iphone 6.0 simulator, fails described in iphone 5.0 simulator.

in appdelegate.m:

     - (void)sessionstatechanged:(fbsession *)session                   state:(fbsessionstate) state                   error:(nserror *)error   {     switch (state) {     case fbsessionstateopen:         if (!error) {                 if(ui_user_interface_idiom()==uiuserinterfaceidiomphone)             {                 flogin *flogin=[[flogin alloc]initwithnibname:@"flogin" bundle:nil];                  self.window.rootviewcontroller=fblogin;  // think because of m getting issue               }            }  } 

in flogin.m

   tab=[[[uitabbarcontroller alloc]init]autorelease];           viewcontroller *searchviewcontroller=[[[viewcontroller   alloc]initwithnibname:@"viewcontroller" bundle:nil]autorelease];             account *account=[[[account alloc]initwithnibname:@"account" bundle:nil]autorelease];             account.title=@"my account";                tab.viewcontrollers=[nsarray arraywithobjects:searchviewcontroller,account,nil];             for(uiviewcontroller *tab1 in  tab.viewcontrollers)              {                 if ([[[uidevice currentdevice] systemversion] floatvalue]>5.0 ||[[[uidevice currentdevice] systemversion] floatvalue]==5.0)                 {                     [tab.tabbaritem settitletextattributes:[nsdictionary dictionarywithobjectsandkeys:                                                             [uifont fontwithname:@"timesnewromanps-boldmt" size:16.0], uitextattributefont, nil]                                                   forstate:uicontrolstatenormal];                 }             }              [self presentmodalviewcontroller:tab animated:no]; 

are saying want switch tabs programmatically in response login? if so, shouldn't using presentmodalviewcontroller:. correct way switch tabs using uitabbarcontroller method.

[self.tabbarcontroller setselectedindex:1]; 

or

[self.tabbarcontroller setselectedviewcontroller:self.myotherviewcontroller]; 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -