嘿,我正在使用 UIPageViewController 来控制我所在的页面和滚动。我知道只需添加以下两个函数就可以显示页面控制器。
- (NSInteger)presentationCountForPageViewController:(UIPageViewController *)pageViewController
- (NSInteger)presentationIndexForPageViewController:(UIPageViewController *)pageViewController
我想知道的是是否可以更改页面控制器的颜色,以便这些点在我正在使用的背景上更明显?
我知道常规页面控制器具有以下属性:
@property(nonatomic,retain) UIColor *currentPageIndicatorTintColor
@property(nonatomic,retain) UIColor *pageIndicatorTintColor
但是,我一生都无法弄清楚如何从 UIPageViewController 访问这些属性或页面控制器。
如果有人只是说一般如何更改属性,这可能会有所帮助?
您可以使用 UIAppearance 配置 UIPageControl 颜色。这也适用于 UIPageViewControllers 中的 UIPageControls。
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions {
UIPageControl *pageControl = [UIPageControl appearance];
pageControl.pageIndicatorTintColor = [UIColor whiteColor];
pageControl.currentPageIndicatorTintColor = [UIColor redColor];
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)