iphone - wrong dismissal after presenting a UIViewController working as a detail view of a tableViewCell -
this question has answer here:
in project app launches in viewcontroller, loads inside table (table class) adding subview (viewcontroller.h - [self.view addsubview: table.tableview];)
camera class detailed view, when tap in table row loads camara.xib. until here works fine.
the problem comes when try dismiss camera.xib , go viewcontroller.xib, when camera.xib dismisses okay instead of going viewcontroller.xib table.xib inside of it, app loads table.xib, rest of objects placed in view of viewcontroller.xib not displaying.
what doing wrong?
thanks in advance!!
code:
table.m
- (void)viewdidload { roomsarray = [[nsmutablearray alloc] initwithobjects:nil]; [super viewdidload]; } - (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath { // code... camara *camara = [[camara alloc] initwithnibname:@"camara" bundle:nil]; [self presentviewcontroller:camara animated:yes completion:nil]; }
camara.m
-(ibaction)cancel:(id)sender { [self dismissviewcontrolleranimated:yes completion:nil]; }
viewcontroller.m
- (void)viewdidload { table = [[table alloc] initwithnibname:@"table" bundle:nil]; [windows.tableview reloaddata]; [self.view addsubview:windows.tableview]; windows.tableview.transform = cgaffinetransformmaketranslation(0, 44); [super viewdidload]; // additional setup after loading view, typically nib.
}
the reason having problem because table view gets added on top of first view, , separate vcs.
picture view controllers trays on stack. add , remove trays progress navigate through app.
i wouldn't suggest having separate view controllers first vc , tableview, instead add tableview first vc. way building stack makes want display tableview , first vc together, not happen if separate viewcontrollers.
it might take more code, add tableview first vc. way, no matter happens, shown together. otherwise, app won't work way want to.
combine them, , problem solved.
Comments
Post a Comment