xcode - iOS application tried to push a nil view controller on target <UINavigationController: -
xmpp using tableview trying go next view controller particular username. have implemented uitablevie's didselectrowatindexpath
correctly. when click on username gives error this.
application tried push nil view controller on target.
"<"uinavigationcontroller: 0x7fe831dac0d0>. 2015-06-04 14:22:51.063
i have declared storyboard in appdelegate.m this.
- (bool)application:(uiapplication *)application didfinishlaunchingwithoptions:(nsdictionary *)launchoptions { chatviewcontroller *chatviewcontroller1 = [[chatviewcontroller alloc]init]; self.storyboard = [uistoryboard storyboardwithname:@"main" bundle:nil]; return yes; }
and here tableview's delegate method.
- (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { [self.tblvwbuddy deselectrowatindexpath:indexpath animated:yes]; xmppusercoredatastorageobject *user = nil; user = [[self fetchedresultscontroller] objectatindexpath:indexpath]; chathistryviewcontroller *chathistory1 = [[chathistryviewcontroller alloc] init]; // or initwith... chathistory1 = [appdelegate.storyboard instantiateviewcontrollerwithidentifier:@"chathistryviewcontroller"];//my next view controller's name chathistory1.chatuserobject = user; chathistory1.hidesbottombarwhenpushed = yes; chathistory1.self.tabbarcontroller.navigationitem.title = user.displayname; [self.tabbarcontroller.navigationcontroller pushviewcontroller:chathistory1 animated:yes]; }
what missing in ? or wrong?
try this:
uitabbarcontroller *vc = [self.storyboard instantiateviewcontrollerwithidentifier:@"main"]; nsarray *listviewcontroller=vc.viewcontrollers; vc.selectedviewcontroller=[listviewcontroller objectatindex:1]; [self presentviewcontroller:vc animated:yes completion:nil];
ps.... listviewcontroller objectatindex: 1 <--- indicates position want show viewcontroller
Comments
Post a Comment