我閱讀了文檔,但是我仍然無法把頭圍繞在這個文檔上。我有一個導航VC,我設置了一個pageview VC作爲其根(它不會在ViewView控制器中的viewdidload中找到我的斷點)。迄今爲止所有事情都在故事板上完成試圖瞭解PageViewController
我現在在故事板中創建兩個新的viewcontrollers並與這兩個創建一個數組?他們從哪裏獲得VC的VC頁面?
謝謝。
下面是從pageviewcontroller一些代碼:(什麼也沒有發生,只是一個黑屏)
@implementation ResultsViewController
- (void)viewDidLoad
{
[super viewDidLoad];
self.delegate=self;
self.dataSource=self;
NSMutableArray *array=[[NSMutableArray alloc]init];
[array addObject:[[Page1ViewController alloc]init]];
[array addObject:[[Page2ViewController alloc]init]];
[self setViewControllers:[NSArray arrayWithArray:array] direction:UIPageViewControllerNavigationDirectionForward animated:YES completion:nil];
// Do any additional setup after loading the view.
}
-(void)setViewControllers:(NSArray *)viewControllers direction:(UIPageViewControllerNavigationDirection)direction animated:(BOOL)animated completion:(void (^)(BOOL))completion{};
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
它看起來像你已經覆蓋setViewControllers那裏,是這種情況? – jrturton
不這麼認爲,只是添加它,因爲示例代碼有它...我沒有它試過,效果相同 –