ios - indexpath row not getting in prepare for segue for detail disclosure -
if([segue.identifier isequaltostring:@"edit"]){ addcoffeeviewcontroller *avc = [segue destinationviewcontroller]; coffee *coffeeobj = [appdelegate.coffeearray objectatindex:arow]; nslog(@"viewcontroller.m prepareforsegue: arow: %d coffeename:%@ price:%@ coffeeid:%d",arow,coffeeobj.coffeename,coffeeobj.price,coffeeobj.coffeeid); [coffeeobj setisineditmode:yes]; avc.editcoffeeobj = coffeeobj; }
i not getting right row when pressing accessory button. although in below method getting right row. there way can right row prepare segue if not want utilize ivar.
-(void)tableview:(uitableview *)tableview accessorybuttontappedforrowwithindexpath:(nsindexpath *)indexpath{ arow = indexpath.row; }
tableviewcell accessory button: performing modal segue(edit) + button (navigation bar button item): performing modal segue(add)
if have hooked accessory action in storyboard sender
in prepareforsegue:sender:
cell that tapped. means can like
nsindexpath *indexpath = [self.tableview indexpathforcell:sender];
ios objective-c
No comments:
Post a Comment