How can i call the method below manually in objective c. I need this because my button is in another class and it has to call the method of another class. And that method is a delegate method which i need to call. CAn anyone guide me in this.
Thanks in advance.
This is the method i need to call which in class A.
- (UIViewController *)pageViewController:(UIPageViewController *)pageViewController viewControllerAfterViewController:(UIViewController *)viewController
{
int index = [self.VControllers indexOfObject:viewController];
if (index + 1 < [self.VControllers count])
{
return [self.VControllers objectAtIndex:index + 1];
}
return nil;
}
Class B:
-(void)next
{
exampleViewController *vc = [[exampleViewController alloc]init];
[vc pageViewController:vc.pageViewController viewControllerAfterViewController:vc.view];
}
What i need is to move the next View Controller through this method.
[instanceName pageViewController: upvc viewControllerAfterViewController: uvw];
Where instanceName is the instance of the class containing this metod, upvc is the UIPageViewController parameter you pass along and uvw is the UIViewController parameter that you pass along.
If you want to do something with the the returned UIViewController do:
UIViewController *vc = [instanceName pageViewController: upvc viewControllerAfterViewController: uvw];
If you want to call it from a button you have to declare an IBAction method that handles the buttons touch up inside event. From the IBAction you can call this method. So declare the IBAction in your .h
and in the .m implement like this