ViewController access data

Posted by Giovanni Filaferro on Stack Overflow See other posts from Stack Overflow or by Giovanni Filaferro
Published on 2012-10-27T07:20:45Z Indexed on 2012/10/28 11:02 UTC
Read the original article Hit count: 308

Filed under:
|

Today i would ask you if there is a way to call a method of another view controller just not initializing it or just how to get that viewController as a global variable declared in .h file. Help me please. I'm using a PageViewController and I have to use a method of the contentViewController alredy initialized.

here I create my ViewControllers:

- (void)createTheContent {

NSLog(@"createTheContent");
pageController = nil;
//[pageController removeFromParentViewController];
//[pageController awakeFromNib];
NSDictionary *options = [NSDictionary dictionaryWithObject:[NSNumber numberWithInteger:UIPageViewControllerSpineLocationMin] forKey: UIPageViewControllerOptionSpineLocationKey];

self.pageController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStylePageCurl navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options: options];

pageController.dataSource = self;
[[pageController view] setFrame:CGRectMake(0, 0, 320, 365)];

initialViewController = [self viewControllerAtIndex:0];
NSMutableArray *viewControllers = [NSArray arrayWithObject:initialViewController];
[pageController setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:nil];

[self addChildViewController:pageController];
[[self view] addSubview:[pageController view]];
[pageController didMoveToParentViewController:self];


}

here are my propertys in .h file:

        contentViewController *initialViewController;
}

//Page View Controller Properties
@property (strong, nonatomic) UIPageViewController *pageController;
@property (strong, nonatomic) NSArray *pageContent;
@property (strong, nonatomic) NSMutableArray *pageStrings;
@property (strong, nonatomic) id dataObject;

© Stack Overflow or respective owner

Related posts about ios

Related posts about xcode