I have the following ViewController
:
class PageContentViewController: UIViewController {
var pageIndex: Int
}
How would I access pageIndex
from another ViewController?
I need to access pageIndex
in this function:
func pageViewController(pageViewController: UIPageViewController!, viewControllerBeforeViewController viewController: UIViewController!) -> UIViewController! {
//var index: Int
//index = ?
NSUInteger index = ((PageContentViewController*) viewController).pageIndex; // in Swift?
if ((index == 0) || (index == NSNotFound)) {
return nil;
}
index--;
return [self viewControllerAtIndex:index]; // in Swift?
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…