ios - How to show a view created inside the custom tableview cell by swiping the row? -


i have created iphone app has custom tableview cell , created view in cellforrowatindexpath. now, when swiping the cell in uitable view created should displayed in particular cell , other cell contents should remained same.

my code follows:

- (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { rkcardcell *cell = [self.tableview dequeuereusablecellwithidentifier:@"rkcardcell"];  // configure cell... if (cell == nil) {     cell = [[rkcardcell alloc] initwithstyle:uitableviewcellstyledefault reuseidentifier:@"rkcardcell"]; } uiswipegesturerecognizer *swipegesture = [[uiswipegesturerecognizer alloc] initwithtarget:self action:@selector(swipemethod:)]; swipegesture.direction = uiswipegesturerecognizerdirectionleft; [cell addgesturerecognizer:swipegesture];  uiview *view = [[uiview alloc] initwithframe:cgrectmake(-320.0, 8.0, 300, 180)]; [view setbackgroundcolor:[uicolor greencolor]];  cell.profileimage.image = [uiimage imagenamed:[photoarray objectatindex:indexpath.row]]; cell.titlelabel.text = [titlearray objectatindex:indexpath.row]; cell.namelabel.text = [namearray objectatindex:indexpath.row]; cell.descriptionlabel.text = [descriptionarray objectatindex:indexpath.row];  //%%% made cards pseudo dynamic, i'm asking cards change frames depending on height of cell cell.cardview.frame = cgrectmake(10, 5, 300, [((nsnumber*)[cardsizearray objectatindex:indexpath.row])intvalue]-10);  return cell; } 

following code gesture swiping:

- (void)swipemethod:(uigesturerecognizer *)gesturerec { [uiview animatewithduration: 0.5 animations:^{     cgrectoffset(self.rkcardcell.cardview.frame, -320.0, 0.0); }];  } 

thanks in advance.

it if use gesture recognizer table view.

uiswipegesturerecognizer *swipegesture = [[uiswipegesturerecognizer alloc] initwithtarget:self action:@selector(swipetarget:)]; swipegesture.direction = uiswipegesturerecognizerdirectionleft; [cell addgesturerecognizer:_mytableview]; 

and swipe target method follows.

- (ibaction)swipetarget:(uiswipegesturerecognizer *)gesturerecognizer {     cgpoint swipepoint         = [gesturerecognizer locationinview:_mytableview];     nsindexpath *cellindexpath = [_mytableview indexpathforrowatpoint:swipepoint];     rkcardcell *cell           = [_mytableview cellforrowatindexpath:cellindexpath];      // add code here show view     [uiview animatewithduration: 0.5 animations:^{            cgrectoffset(cell.cardview.frame, -320.0, 0.0);     }]; } 

Comments

Popular posts from this blog

java - Oracle EBS .ClassNotFoundException: oracle.apps.fnd.formsClient.FormsLauncher.class ERROR -

c# - how to use buttonedit in devexpress gridcontrol -

nvd3.js - angularjs-nvd3-directives setting color in legend as well as in chart elements -