Guest User

Untitled

a guest
Jan 21st, 2019
78
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.89 KB | None | 0 0
  1. @interface RootViewController ()
  2. @property (readonly, strong, nonatomic) ModelController *modelController;
  3. @end
  4.  
  5. @implementation RootViewController
  6.  
  7. @synthesize pageViewController = _pageViewController;
  8. @synthesize modelController = _modelController;
  9. @synthesize navContr = _navContr;
  10.  
  11. - (void)viewDidLoad
  12. {
  13. [super viewDidLoad];
  14. // Do any additional setup after loading the view, typically from a nib.
  15. // Configure the page view controller and add it as a child view controller.
  16.  
  17. //[self presentModalViewController:navContr animated:YES];
  18.  
  19. self.pageViewController = [[[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStylePageCurl navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil] autorelease];
  20. self.pageViewController.delegate = self;
  21.  
  22. DataViewController *startingViewController = [self.modelController viewControllerAtIndex:0 storyboard:self.storyboard];
  23. NSArray *viewControllers = [NSArray arrayWithObject:startingViewController];
  24. [self.pageViewController setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:NULL];
  25.  
  26. self.pageViewController.dataSource = self.modelController;
  27.  
  28. [self addChildViewController:self.pageViewController];
  29. [self.view addSubview:self.pageViewController.view];
  30.  
  31. self.navContr = [[UINavigationController alloc] initWithRootViewController:self.pageViewController];
  32. [self.view addSubview:self.navContr.view];
  33.  
  34.  
  35. // Set the page view controller's bounds using an inset rect so that self's view is visible around the edges of the pages.
  36. CGRect pageViewRect = self.view.bounds;
  37. self.pageViewController.view.frame = pageViewRect;
  38.  
  39. [self.pageViewController didMoveToParentViewController:self];
  40.  
  41. // Add the page view controller's gesture recognizers to the book view controller's view so that the gestures are started more easily.
  42. self.view.gestureRecognizers = self.pageViewController.gestureRecognizers;
  43. for (UIGestureRecognizer *recognizer in self.pageViewController.gestureRecognizers){
  44. if ([recognizer isKindOfClass:[UITapGestureRecognizer class]]){
  45. [recognizer setEnabled:NO];
  46. }
  47. }
  48. }
  49.  
  50. yourTableView.delegate = self;
  51. yourTableView.datasource = self;
  52.  
  53. DetailsViewController *detailsVC = [[DetailsViewController alloc] init];
  54. detailsVC.detailsMessage = @"The Data you want to pass.";
  55. [self.navigationController pushViewController:detailsVC animated:YES];
  56.  
  57. [self.navigationController setNavigationBarHidden:YES animated:YES];
  58.  
  59. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  60. {
  61. self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
  62. // Override point for customization after application launch.
  63. self.viewController = [[OJFViewController alloc] initWithNibName:@"MainViewController" bundle:nil];
  64. self.window.rootViewController = self.viewController;
  65. [self.window makeKeyAndVisible];
  66. return YES;
  67. }
  68.  
  69. @property (nonatomic, strong) UINavigationController *navigationController;
  70.  
  71. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
  72. {
  73. self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
  74. // Override point for customization after application launch.
  75. self.viewController = [[OJFViewController alloc] initWithNibName:@"MainViewController" bundle:nil];
  76.  
  77. self.navigationController = [[UINavigationController alloc] initWithRootViewController:self.viewController];
  78.  
  79. self.window.rootViewController = self.navigationController;
  80. [self.window makeKeyAndVisible];
  81. return YES;
  82. }
  83.  
  84. [self.navigationController setNavigationBarHidden:YES animated:animated];
  85.  
  86. DetailViewController *detailView = [[DetailViewController alloc] initWithNibName:@"DetailViewController" bundle:nil];
  87.  
  88. //pass in details of which row was selected.
  89.  
  90. [self.navigationController pushViewController:detailView animated:YES];
Add Comment
Please, Sign In to add comment