ios - Shake gesture and prepare for seuge - Unbalanced calls to begin/end appearance transitions -
i have uitabelviewcontroller
(mainviewctrl), if user select cell, new uiviewcontroller
(detailviewctrl) been pushed "scene", detail data regarding selected cell. - pretty simple stuff.
if user shakes phone, (detailviewctrl) been showed random detail data.
here prepareforseque
code:
- (void)prepareforsegue:(uistoryboardsegue *)segue sender:(id)sender { if ([segue.identifier isequaltostring:@"detailviewseque"]) { int i; if ([sender iskindofclass:[uitableviewcell class]]){ uitableviewcell *cell = (uitableviewcell*)sender; nsindexpath *indexpath = [self.minifigstableview indexpathforcell:cell]; = indexpath.row; }else{ = arc4random() % [self.collectionofdata count]; } deatilviewcontroller *dest = [segue destinationviewcontroller]; dest.data = [self.collectionofdata objectatindex:i]; } }
the code pretty simple, nothing fancy. problem is, if user shakes phone while transitions between 2 viewcontroller (mainviewctrl , detailviewctrl) going on, error:
unbalanced calls begin/end appearance transitions for.
i understand why causes problem.
but how solve it? how somehow stop uigestureevent been fired, while transitions active?
may can add boolean property "isintransit"
.
set false
in viewwillappear
,
set true
in prepareforsegue
(just int i;
).
and in motionended
(shake method) test if (isintransit=true)
-> don't handle shake, don't fire segue.
hop help
Comments
Post a Comment