UIPageViewController에서 PageControl/페이지 표시기의 색상을 첫 번째 페이지에만 바꿀 수 있습니다. 필자의 경우에는 각 페이지가 다른 색상이어야하므로 PageControl/페이지 표시기를 사용하여 색상을 페이지와 일치시켜야합니다. 페이지 인덱스를 기반으로 색상을 변경하려고 시도했지만 작동하지 않습니다.UIPageViewController : 페이지 당 페이지 표시기/페이지 컨트롤의 색을 변경하십시오.
누구든지 문제를 해결하는 방법을 알고 계십니까?
- (PageContentViewController *)viewControllerAtIndex:(NSUInteger)index
{
if ([tutorialItems count] == 0) {
return nil;
}
// Create a new view controller and pass suitable data.
PageContentViewController *pageContentViewController
= [self.storyboard instantiateViewControllerWithIdentifier:@"PageContentViewController"];
TutorialItem *tutorialItem = [tutorialItems objectAtIndex:index];
pageContentViewController.imageFile = tutorialItem.tutorialImageFileName;
pageContentViewController.titleText = tutorialItem.tutorialTitle;
pageContentViewController.tutorialText = tutorialItem.tutorialText;
int red = tutorialItem.tutorialRedKey;
int green = tutorialItem.tutorialGreenKey;
int blue = tutorialItem.tutorialBlueKey;
pageContentViewController.pageIndex = index;
tutorialBackgroundColor = [UIColor colorWithRed:red/255.0f green:green/255.0f blue:blue/255.0f alpha:1.0f];
pageContentViewController.tutorialBackgroundColor = tutorialBackgroundColor;
UIPageControl *pageControl = [UIPageControl appearance];
pageControl.pageIndicatorTintColor = [UIColor blackColor];
pageControl.currentPageIndicatorTintColor = [UIColor whiteColor];
pageControl.backgroundColor = [UIColor clearColor];
pageContentViewController.pageControllerColor = tutorialBackgroundColor;
return pageContentViewController;
}