我可以得到 UIPageControl
上类时PageViewController
导航样式设置为 Horizontal
, 但是当我选择 Vertical
UIPageControl
不会出现水平或垂直。
我在 AppDelegate 中设置 UIPageControl 的外观:
- (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;
}
有没有办法让它出现在垂直位置?上面的代码在
Horizontal
时有效为导航选择了选项,但当 Vertical
被选中。
最佳答案
如果我理解正确,您要做的是使用 UIPageViewController
与 垂直 方向并同时显示 UIPageControl
垂直。我试图这样做,但似乎 UIPageControl
与 UIPageViewController
相关不能直接访问。
但是,我找到了一个非常令人满意的解决方法来解决您的问题。使用UIScrollView
与 分页启用 并管理UIPageControl
在 scrollView 的委托(delegate)方法中。显示 UIPageControl
垂直,您可以使用
pageControl.transform = CGAffineTransformMakeRotation(M_PI / 2);
我制作了一个示例应用程序来演示此解决方法。 Here是下载链接。如果它可以帮助您解决问题,请考虑接受该问题,谢谢。
关于ios7 - 选择垂直时 UIPageControl 不出现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21914732/