I have a PageAViewController.m containing the following code..
This sets up a PageAView controlled by PageAViewController with a navigation button to initialize PageBViewController (that controls PageBView) and slide it over.
Within PageAView I have a UIButton I also want to trigger the slide. I can't work out how to do this. I would imagine it to be something like...
..to call the function in PageAViewController. However I can't work this out.
Thanks
Code:
-(id)init {
if (self = [super init]) {
self.title = @"Page A";
UIBarButtonItem *navButton = [[UIBarButtonItem alloc] initWithTitle:@"Page B" style:UIBarButtonItemStylePlain target:self action:@selector(doPush)];
self.navigationItem = navButton;
}
return self;
}
-(void)loadView {
PageAView *pageAView = [[PageAView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
[self setView:pageAView];
}
-(void)doPush {
PageBViewController *pageBViewController = [[[PageBViewController alloc] init] autorelease];
[self.navigationController pushViewController:pageBViewController animated:YES];
}
This sets up a PageAView controlled by PageAViewController with a navigation button to initialize PageBViewController (that controls PageBView) and slide it over.
Within PageAView I have a UIButton I also want to trigger the slide. I can't work out how to do this. I would imagine it to be something like...
Code:
UIButton *button ........
[button addTarget:self action:@selector([self.viewController doSlide]) forControlEvents:UIControlEventTouchUpInside];
..to call the function in PageAViewController. However I can't work this out.
Thanks