iphone - connect UITableView + UITableView -
right have indexed uitableview goes detail view want go uitableview detail view.
my code this:
` - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath {
displyanncontroller *ancontroller = [[displyanncontroller alloc] initwithnibname:@"annview" bundle:[nsbundle mainbundle]]; detailviewcontroller *dvcontroller = [[detailviewcontroller alloc] initwithstyle:uitableviewstylegrouped]; switch (indexpath.row) { case 0: [self.navigationcontroller pushviewcontroller:ancontroller animated:yes]; [ancontroller release]; ancontroller = nil; break; case 1: [self.navigationcontroller pushviewcontroller:dvcontroller animated:yes]; [dvcontroller release]; dvcontroller = nil; break; default: break; }`
and when press cell index 0 in simulator, program crash!
what's problem? pleas me ..
no, didn't override -initwithnibname
, use same way here,but push controlview not tableview.also,no errors in debug console. , have tried release controllers after switch block, program still crash :( anyway, it's work when write:
displyanncontroller *ancontroller = [[displyanncontroller alloc] initwithstyle:uitableviewstylegrouped]];
instead of :
displyanncontroller *ancontroller = [[displyanncontroller alloc] initwithnibname:@"annview" bundle:[nsbundle mainbundle]]
temporarily, accept complete work! hope find example because no need group.
thanks , recommendations.
view debug console (cmd-shift-r
) , see error is.
are overriding -initwithnibname
message on displyanncontroller
? or -viewdidload
message?
you have memory leak. +alloc
both controllers, -release
1 of them. don't +alloc
controller unless going use it.
Comments
Post a Comment