uitableview - UIGestureRecognizer Issue: trying to navigate backwards -


trying make if user swipes left, app navigate backwards. lately success i've had if specify uitableview; if cell selected , swipe occurs within cell navigate backwards, that's it. i'd make user can swipe anywhere on screen without being confined swiping value in table cell. after they've done so, initial array menu displayed. feedback? code below:

- (void)viewdidload {     [super viewdidload];     arrayno = [[nsmutablearray alloc] init];     [[self mytableview] setdelegate:self];     [[self mytableview] setdatasource:self];      uiswipegesturerecognizer * = [[uiswipegesturerecognizer alloc] initwithtarget:self action:@selector(reload)];     [back setdirection:(uiswipegesturerecognizerdirectionleft)];     [self.view addgesturerecognizer:back];      if (back)     {         nslog(@"swiped");         nsstring *arts = @"arts , museums";         nsstring *coffee = @"coffee , bakeries";         nsstring *tours = @"tours , festivals";         nsstring *hotels = @"hotels , inns";         nsstring *leisure = @"leisure , recreation";         nsstring *music = @"live music";         nsstring *bars = @"night clubs , bars";         nsstring *food = @"restaurants";         nsstring *shopping = @"shopping";         nsstring *transportation = @"transportation";          [arrayno removeallobjects];          [arrayno addobject:arts];         [arrayno addobject:coffee];         [arrayno addobject:tours];         [arrayno addobject:hotels];         [arrayno addobject:leisure];         [arrayno addobject:music];         [arrayno addobject:bars];         [arrayno addobject:food];         [arrayno addobject:shopping];         [arrayno addobject:transportation];     } } 

i believe making things complicated. solve, using this:

- (void)tableview:(uitableview *)tableview didselectrowatindexpath:(nsindexpath *)indexpath {     uitableviewcell *cell = [tableview cellforrowatindexpath:indexpath];      uiswipegesturerecognizer * = [[uiswipegesturerecognizer alloc] initwithtarget:self action:@selector(backup1)];     [back setdirection:(uiswipegesturerecognizerdirectionleft)];     [self.view addgesturerecognizer:back];      if ([cell.textlabel.text isequaltostring: @"arts , museums"])     {                 nsstring *galleries = @"art galleries";         nsstring *dramatic = @"dramatic arts";         nsstring *museums = @"museums";          [arrayno removeallobjects];          [arrayno addobject:galleries];         [arrayno addobject:dramatic];         [arrayno addobject:museums];          [self.mytableview reloaddata];     } }  -(void)backup1 {     nslog(@"swiped");     nsstring *arts = @"arts , museums";     nsstring *coffee = @"coffee , bakeries";     nsstring *tours = @"tours , festivals";     nsstring *hotels = @"hotels , inns";     nsstring *leisure = @"leisure , recreation";     nsstring *music = @"live music";     nsstring *bars = @"night clubs , bars";     nsstring *food = @"restaurants";     nsstring *shopping = @"shopping";     nsstring *transportation = @"transportation";      [arrayno removeallobjects];      [arrayno addobject:arts];     [arrayno addobject:coffee];     [arrayno addobject:tours];     [arrayno addobject:hotels];     [arrayno addobject:leisure];     [arrayno addobject:music];     [arrayno addobject:bars];     [arrayno addobject:food];     [arrayno addobject:shopping];     [arrayno addobject:transportation];      [self.mytableview reloaddata]; } 

Comments

Popular posts from this blog

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -