Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @interface RootViewController ()
- @property (readonly, strong, nonatomic) ModelController *modelController;
- @end
- @implementation RootViewController
- @synthesize pageViewController = _pageViewController;
- @synthesize modelController = _modelController;
- @synthesize navContr = _navContr;
- - (void)viewDidLoad
- {
- [super viewDidLoad];
- // Do any additional setup after loading the view, typically from a nib.
- // Configure the page view controller and add it as a child view controller.
- //[self presentModalViewController:navContr animated:YES];
- self.pageViewController = [[[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStylePageCurl navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil] autorelease];
- self.pageViewController.delegate = self;
- DataViewController *startingViewController = [self.modelController viewControllerAtIndex:0 storyboard:self.storyboard];
- NSArray *viewControllers = [NSArray arrayWithObject:startingViewController];
- [self.pageViewController setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:NULL];
- self.pageViewController.dataSource = self.modelController;
- [self addChildViewController:self.pageViewController];
- [self.view addSubview:self.pageViewController.view];
- self.navContr = [[UINavigationController alloc] initWithRootViewController:self.pageViewController];
- [self.view addSubview:self.navContr.view];
- // Set the page view controller's bounds using an inset rect so that self's view is visible around the edges of the pages.
- CGRect pageViewRect = self.view.bounds;
- self.pageViewController.view.frame = pageViewRect;
- [self.pageViewController didMoveToParentViewController:self];
- // Add the page view controller's gesture recognizers to the book view controller's view so that the gestures are started more easily.
- self.view.gestureRecognizers = self.pageViewController.gestureRecognizers;
- for (UIGestureRecognizer *recognizer in self.pageViewController.gestureRecognizers){
- if ([recognizer isKindOfClass:[UITapGestureRecognizer class]]){
- [recognizer setEnabled:NO];
- }
- }
- }
- yourTableView.delegate = self;
- yourTableView.datasource = self;
- DetailsViewController *detailsVC = [[DetailsViewController alloc] init];
- detailsVC.detailsMessage = @"The Data you want to pass.";
- [self.navigationController pushViewController:detailsVC animated:YES];
- [self.navigationController setNavigationBarHidden:YES animated:YES];
- - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
- {
- self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
- // Override point for customization after application launch.
- self.viewController = [[OJFViewController alloc] initWithNibName:@"MainViewController" bundle:nil];
- self.window.rootViewController = self.viewController;
- [self.window makeKeyAndVisible];
- return YES;
- }
- @property (nonatomic, strong) UINavigationController *navigationController;
- - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
- {
- self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
- // Override point for customization after application launch.
- self.viewController = [[OJFViewController alloc] initWithNibName:@"MainViewController" bundle:nil];
- self.navigationController = [[UINavigationController alloc] initWithRootViewController:self.viewController];
- self.window.rootViewController = self.navigationController;
- [self.window makeKeyAndVisible];
- return YES;
- }
- [self.navigationController setNavigationBarHidden:YES animated:animated];
- DetailViewController *detailView = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:nil];
- //pass in details of which row was selected.
- [self.navigationController pushViewController:detailView animated:YES];
Add Comment
Please, Sign In to add comment