简体   繁体   中英

how to disable swiping of pages in a view in page based application

In my App i am using a page based application where swiping of page will happen in two ways

1.By swiping of fingers

2.By tapping

i have disabled tapping of pages using code.

Now what my requirement is i have a button where click on button i add a view top of it.In this view when i swipe by fingers the swiping of pages still happens which should not.so how to disable the swiping of pages when i add a view. Below is the code where i had a view.In this view i want to disable swiping action

-(IBAction)goTopopUp:(id)sender{
    myView.hidden = NO;
    myView.backgroundColor = [UIColor colorWithWhite:0 alpha:.5];
    [self.pageViewController.view addSubview:myView];
    [self.view addSubview:searchBar];
}

NOTE: Its a page based application

-(IBAction)goTopopUp:(id)sender{
    myView.hidden = NO;
    myView.backgroundColor = [UIColor colorWithWhite:0 alpha:.5];
    [self.pageViewController.view addSubview:myView];
    self.pageViewController.view.userInteractionEnabled = NO;
    [self.view addSubview:searchBar];
}

Then, when hiding view switch it to YES

You could use UIPageViewController 's dataSource methods. Check if your view is visible, and if yes, return nil; in – pageViewController:viewControllerBeforeViewController: and – pageViewController:viewControllerAfterViewController: . Hope this helps :).

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM