Reputation: 7022
I can get the UIPageControl
to work when the PageViewController
Navigation style is set to Horizontal
, however when I choose Vertical
the UIPageControl
does not appear horizontal or vertical.
I am setting the appearance of my UIPageControl in the AppDelegate:
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
// Override point for customization after application launch.
UIPageControl *pageControl = [UIPageControl appearance];
pageControl.pageIndicatorTintColor = [UIColor lightGrayColor];
pageControl.currentPageIndicatorTintColor = [UIColor blackColor];
pageControl.backgroundColor = [UIColor whiteColor];
return YES;
}
Is there a way to make it appear in a vertical position? The code above works when the Horizontal
option is selected for navigation but not when the Vertical
is selected.
Upvotes: 3
Views: 1310
Reputation: 5448
If I understand correctly, what you want to do is to use UIPageViewController
with vertical orientation and also display the UIPageControl
vertically. I tried to do that, but it seems that the UIPageControl
related to the UIPageViewController
is not accessible directly.
However, I found a very satisfactory workaround to your problem. Use UIScrollView
with pagingEnabled and manage the UIPageControl
in the scrollView's delegate methods. To display the UIPageControl
vertically, you can use
pageControl.transform = CGAffineTransformMakeRotation(M_PI / 2);
I made a sample application demonstrating this workaround. Here is the download link. Consider accepting the question if it helped you solve the problem, thanks.
Upvotes: 11