0

Now I am creating app tour for my app by using uipageviewcontroller, its working fine when I am swipe the pages in view controller but what I need was the page will move when I click the button below is my button click action here i can able to put only custom page index but I need to give the current page of the index

- (IBAction)donebtnaction:(id)sender {

    NSLog(@"current page: %@",indexpathpage);

    PageContent *startingViewController = [self viewControllerAtIndex:0];

    NSArray *viewControllers = @[startingViewController];
    [self.PageViewController setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionReverse animated:NO completion:nil];
}

and i am also tried to save the index when swipe after and swipe before,

- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerAfterViewController:(UIViewController *)viewController{

    NSUInteger index = ((PageContent*) viewController).pageIndex;

    if (index == NSNotFound){
        return nil;
    }

    index++;
    [self.pagecontrol setCurrentPage:index];
    if (index == [self.arrPageTitles count])
    {
        return nil;
    }
    return [self viewControllerAtIndex:index];
}

Please give me solution for this .

Meet Doshi
  • 4,241
  • 10
  • 40
  • 81
Hari Narayanan
  • 754
  • 1
  • 12
  • 36

1 Answers1

0

Try navigating the page by pop and push actions . That will help to which action u are performing and which indexPath its heading .

For example for push which is inserting from stack

 xController *xVC = [[xController alloc]init];
xVC.view.backgroundColor = [UIColor whiteColor];
[self.navigationController pushViewController:xVC animated:YES];}

for example to pop which means taking it out from the stack

 [self.navigationController popViewControllerAnimated:YES];
Santhosh
  • 525
  • 5
  • 13
  • chintz i don't need to move the page from one view controller to another view controller i am using pageviewcontroller to move – Hari Narayanan Jul 04 '16 at 07:42