關閉這個問題剛纔看到我面對一個嚴重的問題,在過去兩天重複之前。獲得索引號UIpageviewController緩慢,而使用自定義的PageControl
我下面UIPageViewController with storyboards tutorial。
我想發展我UIPageviewController。我必須展示一些用戶照片。我不想在底部顯示apagecontrol,所以我創建了一個自定義頁面控件。當我嘗試索引設置爲它不能正常工作的UIPageControl - 得到一些延遲一些時間達到第5頁只有它的更新,使得數目不正確
這是我的數據源:
-(UIViewController*)pageViewController:(UIPageViewController *)pageViewController viewControllerBeforeViewController:(UIViewController *)viewController
{
NSUInteger index = ((BMEnlargePhotoPageView*) viewController).pageIndex;
[self.enlargePhotoPageControl setCurrentPage:index];
if((index == 0) || (index==NSNotFound)){
return nil;
}
index--;
return [self viewControllerATindex:index];
}
-(UIViewController*)pageViewController:(UIPageViewController *)pageViewController viewControllerAfterViewController:(UIViewController *)viewController
{
NSUInteger index = ((BMEnlargePhotoPageView*) viewController).pageIndex;
[self.enlargePhotoPageControl setCurrentPage:index];
if(index==NSNotFound){
return nil;
}
index++;
if(index==[self.userImages count])
{
return nil;
}
return [self viewControllerATindex:index];
}
- (BMEnlargePhotoPageView*)viewControllerATindex:(NSUInteger)index
{
if(([self.userImages count]==0) || (index >= [self.userImages count])){
}
BMEnlargePhotoPageView *PageContentViewControl = [self.storyboard instantiateViewControllerWithIdentifier:@"EnlargePhoto"];
PageContentViewControl.imageFIle =self.userImages[index];
PageContentViewControl.pageIndex = index;
return PageContentViewControl;
}
我的其他問題在於我想查找當前可見照片的索引ID,因此我也無法正確使用 - 延遲的值並且不正確。
注意:當我使用動畫頁面滾動一切運作良好,但在滾動動畫它得到延遲,但我想顯示它作爲滾動只有我試過很多SO激光沒有得到我的問題一些指南或我做任何錯誤。
你有viewcontrollers數組或只有一個viewcontroller? – 2015-09-18 04:36:09
這是有效的,但是由於某種原因,動畫是「延遲」的,就好像您使用的是原生頁面控件(可通過實現頁面控制器委託來設置)。 – Pochi