簡體   English   中英

uiswipegesturerecognizer從UITableview IOS的​​詳細視圖傳遞

[英]uiswipegesturerecognizer to pass from detail views of an UITableview IOS

我有一個UITableView顯示一些元素,當我單擊每個單元格時,我可以看到它的detailViewController。 我想從一個detailViewController傳遞到下一個,將UISwipeGestureRecognizer移到左側,如果我將UISwipeGestureRecognizer移至右側,請返回tableView。

謝謝

將滑動識別器添加到視圖或表格視圖

UISwipeGestureRecognizer *swipeLeft = [[UISwipeGestureRecognizer alloc] initWithTarget:self action:@selector(goToNextView)];

    [swipeLeft setDirection:UISwipeGestureRecognizerDirectionLeft];
    [self.view addGestureRecognizer:swipeLeft]; //Add to the view or tableview or whatever

添加方法

- (void)goToNextView
{
     YourViewController *vc =
     [self.storyboard instantiateViewControllerWithIdentifier:@"yourViewControllerIdendifier"];
     [self.navigationController pushViewController:vc animated:YES];
}

進行相同的操作以返回,但不要使用推,而要使用pop

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM