ios - Tips on how to diagnose a view controller losing reference to parent view controller -
i have class someviewcontroller
has gesture recognizer on 1 of it's views, , double-tapping triggers handler gesture, creates , throws uinavigationcontroller, wraps irpimageviewerviewcontroller.
irpimageviewerviewcontroller lone content controller inside uinavigationcontroller. have nslog statement shows following result @ given point.
<irpimageviewerviewcontroller: 0x84689690>'s parentviewcontroller <uinavigationcontroller: 0x7ca31800>
then @ point later, double-tap gesture, triggering code again, , nslog statement logs message.
<irpimageviewerviewcontroller: 0x84689690>'s parentviewcontroller (null)
how on earth uinavigationcontrollers content controller lose it's connection it's containing uinavigationcontroller. i'm not doing mysterious or weird, trying reference or use content controller, maintaining it's lifetime manually.
also in log, i'm not putting there, disturbing tidbit...
warning: attempt present <uinavigationcontroller: 0x7e98ee00> on <irpimageviewerviewcontroller: 0x84689690> view not in window hierarchy!
somehow, somewhere, irpimageviewerviewcontroller losing it's reference it's parentviewcontroller, , presentingviewcontroller... both nil.
is there lldb technique determine happening?
the following 2 variables used in code follows
@implementation someviewcontroller { uinavigationcontroller *imageeditornavcontroller; irpimageeditorviewcontroller *imageeditorvc; }
then further down in class, presentation code here, triggered when user double taps on view in irpimageviewerviewcontroller
-(void)handledoubletaprecognizer:(uitapgesturerecognizer*)recognizer { nslog(@"double tapped, opening editor"); igcellpath *pathforcurrentcell = [self pathforcurrentcell]; irpimageandmedia *imageandmediaitem = [thepropertyimageset objectatindex:pathforcurrentcell.columnindex]; imageeditorvc = [[irpimageeditorviewcontroller alloc] initwithimageandmediaitem:imageandmediaitem]; imageeditorvc.navigationitem.title = @"photo details editor"; imageeditorvc.edgesforextendedlayout = uirectedgenone; imageeditornavcontroller = [[uinavigationcontroller alloc] initwithrootviewcontroller:imageeditorvc]; imageeditornavcontroller.modalpresentationstyle = uimodalpresentationformsheet; imageeditornavcontroller.topviewcontroller.navigationitem.rightbarbuttonitem = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem:uibarbuttonsystemitemdone target:self action:@selector(imageeditordone)]; imageeditornavcontroller.topviewcontroller.navigationitem.leftbarbuttonitem = [[uibarbuttonitem alloc] initwithbarbuttonsystemitem:uibarbuttonsystemitemcancel target:self action:@selector(imageeditorcancelled)]; imageeditornavcontroller.preferredcontentsize = imageeditorvc.view.frame.size; nslog(@"%@'s parentviewcontroller %@",self, self.parentviewcontroller); [self presentviewcontroller:imageeditornavcontroller animated:yes completion:^(void){ }]; }
and
-(void)imageeditordone { [self dismissviewcontrolleranimated:yes completion:nil]; } -(void)imageeditorcancelled { [self dismissviewcontrolleranimated:yes completion:nil]; }
Comments
Post a Comment