objective c - Push a string and display in a UITextField -
i doing small app , using uisplitviewcontroller , trying push uitable cell text detail view , display in uitextfield. have managed push string nicely when test nslog when apply uitextfield not display not sure why here method: (i doing using storyboard)
-(void)pushmodulename:(nsstring*)modulename { self.lv4moduletitletextfield.text = modulename; nslog(@"name pushed%@",modulename); }
not sure why doesn't work.
[update]
uitableviewcontroller.m (where method called)
- (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { nsstring *selectedmodule = [nsstring stringwithformat:@"%@",[_numberofrows objectatindex:indexpath.row]]; lv4gradeviewcontroller *lv4 = [[lv4gradeviewcontroller alloc] initwithnibname:nil bundle:nil]; [lv4 pushmodulename:selectedmodule]; }
the problem you're not getting reference lv4gradeviewcontroller have on screen, you're creating new 1 alloc init. split view controller, has viewcontrollers array, controller @ index 0 being master controller, , 1 @ index 1 being detail controller. so, didselectrowatindexpath method should this:
- (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { nsstring *selectedmodule = [nsstring stringwithformat:@"%@",[_numberofrows objectatindex:indexpath.row]]; lv4gradeviewcontroller *lv4 = self.splitviewcontroller.viewcontrollers[1]; [lv4 pushmodulename:selectedmodule]; }
Comments
Post a Comment