ios7 - 选择垂直时 UIPageControl 不出现

标签 ios7 uipageviewcontroller appdelegate uipagecontrol

我可以得到 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垂直。我试图这样做,但似乎 UIPageControlUIPageViewController 相关不能直接访问。

但是,我找到了一个非常令人满意的解决方法来解决您的问题。使用UIScrollView分页启用 并管理UIPageControl在 scrollView 的委托(delegate)方法中。显示 UIPageControl垂直,您可以使用

pageControl.transform = CGAffineTransformMakeRotation(M_PI / 2);

我制作了一个示例应用程序来演示此解决方法。 Here是下载链接。如果它可以帮助您解决问题,请考虑接受该问题,谢谢。

关于ios7 - 选择垂直时 UIPageControl 不出现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/21914732/

相关文章:

objective-c - iOS 8 - View 未调整全屏大小

iphone - 更改 UIPageViewController 转换

swift - iPhone AppDelegate 仅将数组的第一个对象返回给 Watch OS 2 iOS 9

ios - 仅当应用程序处于事件状态时,如何在 performFetchWithCompletionHandler 中执行代码?

swift - 如何以编程方式将 UIPageController 和 UICollectionViewController 添加到 UIViewController

ios - 在后台模式下循环

iOS 7 + iPad : UISearchBar causes navigation bar content to be mixed with status bar

iOS7:Tableview 不加载附件更改

objective-c - 如何在 iOS7 中使用淡入淡出效果切换状态栏(如照片应用程序)?

c# - UIPageViewController 的 DidFinishAnimating 和 WillTransition,如何正确实现这些方法?