试图做到这一点,如果用户向左滑动,应用程序将向后导航。最近我唯一的成功是如果我指定了 UITableView;如果已经选择了一个单元格,然后在该单元格内发生滑动,它将向后导航,仅此而已。我想这样做,以便用户可以在屏幕上的任意位置滑动,而不必局限于在表格单元格中滑动值。完成后,将显示初始数组菜单。任何反馈?下面的代码:
- (void)viewDidLoad
{
[super viewDidLoad];
arrayNo = [[NSMutableArray alloc] init];
[[self myTableView] setDelegate:self];
[[self myTableView] setDataSource:self];
UISwipeGestureRecognizer * back = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(reLoad)];
[back setDirection:(UISwipeGestureRecognizerDirectionLeft)];
[self.view addGestureRecognizer:back];
if (back)
{
NSLog(@"SWIPED");
NSString *arts = @"Arts and Museums";
NSString *coffee = @"Coffee and Bakeries";
NSString *tours = @"Tours and Festivals";
NSString *hotels = @"Hotels and Inns";
NSString *leisure = @"Leisure and Recreation";
NSString *music = @"Live Music";
NSString *bars = @"Night Clubs and 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];
}
}