iphone - Pushing a view controller from a tableview controller doesnt work -



iphone - Pushing a view controller from a tableview controller doesnt work -

i have setup table view controller , connected sub view when click on rows new subview appears. followed few tutorials step step, reason, nil comes when click on rows (the row beingness selected though).

here main view controller:

@interface tableviewsviewcontroller : uiviewcontroller <uitableviewdelegate, uitableviewdatasource> { iboutlet uitableview *tblsimpletable; iboutlet uinavigationbar *navbar; nsarray *arrydata; nsmutablearray *listofitems; } @property (nonatomic, retain) iboutlet uitableview *tblsimpletable; @property (nonatomic, retain) iboutlet uinavigationbar *navbar; @property (nonatomic, retain) nsarray *arrydata; @property (nonatomic, retain) nsmutablearray *listofitems;

.m (relevant portions)

// customize appearance of table view cells. - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"cell"; uitableviewcell *cell = [tableview dequeuereusablecellwithidentifier:cellidentifier]; if (cell == nil) { cell = [[uitableviewcell alloc] initwithstyle: uitableviewcellstylevalue1 reuseidentifier:cellidentifier]; } nsdictionary *dictionary = [listofitems objectatindex:indexpath.section]; nsarray *array = [dictionary objectforkey:@"computers"]; nsstring *cellvalue = [array objectatindex:indexpath.row]; cell.textlabel.text = cellvalue; homecoming cell; } - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *) indexpath { nsdictionary *dictionary = [listofitems objectatindex:indexpath.section]; nsarray *array = [dictionary objectforkey:@"computers"]; nsstring *selectedcountry = [array objectatindex:indexpath.row]; //initialize detail view controller , display it. detailviewcontroller *dvcontroller = [[detailviewcontroller alloc] initwithnibname:@"detailview" bundle:[nsbundle mainbundle]]; dvcontroller.selectedcomputer = selectedcountry; [self.navigationcontroller pushviewcontroller:dvcontroller animated:yes]; dvcontroller = nil; }

and subview controller:

.h

@interface detailviewcontroller : uiviewcontroller { iboutlet uilabel *lbltext; nsstring *selectedcomputer; } @property (nonatomic, retain) iboutlet uilabel *lbltext; @property (nonatomic, retain) nsstring *selectedcomputer; @end

.m

- (void)viewdidload { [super viewdidload]; // additional setup after loading view nib. //display selected country. lbltext.text = selectedcomputer; //set title of navigation bar self.navigationitem.title = @"selected computer"; }

i pretty sure connected in ib.

thanks help!

is table view within navigation controller. can set breakpoint on

[self.navigationcontroller pushviewcontroller:dvcontroller animated:yes];

and take loot @ self.navigationcontroller property. if nil, not able force onto not give error sending message nil simply homecoming nil in cases.

iphone objective-c xcode uiviewcontroller uinavigationcontroller

Comments

Popular posts from this blog

iphone - Dismissing a UIAlertView -

intellij idea - Update external libraries with intelij and java -

javascript - send data from a new window to previous window in php -