Как перевести жест в сторону назад к предыдущему виду ios?

Я пытаюсь вернуться к (QueryController), из которого я пришел. Но никаких действий салфетки не происходит... Не уверен, что им не хватает.

enter image description here

@implementation ProfileController4


- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization

        UISwipeGestureRecognizer * Swiperight=[[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(swiperight:)];
        Swiperight.direction=UISwipeGestureRecognizerDirectionRight;
        [self.view addGestureRecognizer:Swiperight];

        UISwipeGestureRecognizer * Swipeleft=[[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(swipeleft:)];
        Swipeleft.direction=UISwipeGestureRecognizerDirectionLeft;
        [self.view addGestureRecognizer:Swipeleft];
    }
    return self;
}



-(void)swipeleft:(UISwipeGestureRecognizer*)gestureRecognizer
{
    //Do what you want here

}

-(void)swiperight:(UISwipeGestureRecognizer*)gestureRecognizer
{
    //Do what you want here

    [self performSegueWithIdentifier: @"friendsBackToQuerySeg" sender: self];

//      [[UIViewController alloc] initWithNibName:@"QueryController1" bundle:nil];

}

Ответ 1

Добавьте код UISwipeGestureRecognizer в метод viewDidLoad.

- (void)viewDidLoad
{
    [super viewDidLoad];

    UISwipeGestureRecognizer * Swiperight=[[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(swiperight:)];
    Swiperight.direction=UISwipeGestureRecognizerDirectionRight;
    [self.view addGestureRecognizer:Swiperight];

    UISwipeGestureRecognizer * Swipeleft=[[UISwipeGestureRecognizer alloc]initWithTarget:self action:@selector(swipeleft:)];
    Swipeleft.direction=UISwipeGestureRecognizerDirectionLeft;
    [self.view addGestureRecognizer:Swipeleft];
}