- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我按照 UIPageViewController 和 UIPageControl 上的 ios 文档遵循这些说明:
A page indicator will be visible if both methods are implemented, transition style is 'UIPageViewControllerTransitionStyleScroll', and navigation orientation is 'UIPageViewControllerNavigationOrientationHorizontal'. Both methods are called in response to a 'setViewControllers:...' call, but the presentation index is updated automatically in the case of gesture-driven navigation.
- (NSInteger)presentationCountForPageViewController:(UIPageViewController *)pageViewController
- (NSInteger)presentationIndexForPageViewController:(UIPageViewController *)pageViewController
所以我在 UIViewController 包装器类中按如下方式实现了它们:
这里是初始化:
@interface PageViewWrapperViewController : UIViewController <UIPageViewControllerDelegate, UIPageViewControllerDataSource>
@property (strong, nonatomic) UIPageViewController *pageController;
@property (assign, nonatomic) NSInteger index;
@property (strong, nonatomic) UILabel *screenNumber;
@property UIPageControl *childPageControl;
@end
- (void)viewDidLoad {
[super viewDidLoad];
self.index = 0;
self.pageController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil];
self.pageController.dataSource = self;
self.pageController.delegate = self;
[self.pageController.view setFrame:[[self view] bounds]] ;
UIViewController *initialViewController = [self viewControllerAtIndex:0];
NSArray *viewControllers = [NSArray arrayWithObject:initialViewController];
[self.pageController setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:nil];
[self addChildViewController:self.pageController];
[[self view] addSubview:[self.pageController view]];
//[self.pageController didMoveToParentViewController: self];
self.childPageControl = [[UIPageControl alloc] init];
// self.childPageControl = [self getPageControlForPageViewController:self.pageController];
self.childPageControl.alpha = .5;
[self.view bringSubviewToFront:self.childPageControl];
}
以下是 UIPageControl 所需的方法:
- (NSInteger)presentationCountForPageViewController:(UIPageViewController *)pageViewController
{
return 5;
}
-(NSInteger)presentationIndexForPageViewController:(UIPageViewController *)pageViewController
{
return self.index;
}
这里是我给 PageController 单独的 View Controller 的地方:
- (UIViewController *)viewControllerAtIndex:(NSUInteger)index{
if(index==0)
{
//JudgeViewController *next1 = [[JudgeViewController alloc] init];
JudgeTutorViewController *next1 = [[JudgeTutorViewController alloc] init];
next1.view.userInteractionEnabled = NO;
return next1;
}
else if(index==1)
{
FollowTableViewController *next1 = [[FollowTableViewController alloc] init];
next1.view.userInteractionEnabled = NO;
next1.typeDisplay = 1;
return next1;
}
else if (index==2)
{
StatTutorViewController *next1 = [[StatTutorViewController
alloc] init];
next1.view.userInteractionEnabled = NO;
next1.user = [[UserObject userUnique] copyUser].name;
return next1;
}
else if (index==3)
{
MenuTutorViewController *next1 = [[MenuTutorViewController
alloc] init];
next1.view.userInteractionEnabled = NO;
return next1;
}
else if(index ==4)
{
BuzzTutorViewController *next1 = [[BuzzTutorViewController alloc] init];
next1.view.userInteractionEnabled = NO;
return next1;
}
self.index = index;
return nil;
}
UIPageViewController 本身工作正常,但我没有看到 UIPageControl。我的代码中缺少什么?
感谢您的任何建议。
最佳答案
实际上,这两个答案都不是问题所在。事实上,我并没有更改我的代码,但是一旦我刷新了几次我的build设置就成功了。谢谢大家!
关于ios - 为什么我看不到 UIPageControl?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27606163/
我一直在尝试处理一个类项目,在该项目中我必须设置一个面向 GUI 的转换程序,并且我试图将数据从我的类的方法传递到 ActionListener,但监听器是告诉我文本字段不存在。它位于同一个包和类中,
我在服务器上有两个版本的 PHP(Centos 6.8) - 5.6 和 7.1 我的 Nginx 使用 php7.1,它不是默认的 PHP 解释器。 经过一番与 yum 的斗争后,我安装了 php7
我正在尝试为 BEAGLE 安装 OpenCL .首先,我下载了 intel_sdk_for_opencl_applications_2020.3.494.tar.gz 来自 here .然后我解压并
我想知道为什么我在 controlPanel 中看不到 topPanel 这是我的代码: import java.awt.BorderLayout; import java.awt.Color; im
在我的 urls.py 中,我有以下内容: urlpatterns = patterns('', # Examples: #url(r'^$', 'welcome_page.home'
非常感谢大家的帮助! 在 GetProductByID 下,我收到一条错误消息“int does not contain a definition for FirstOrDefault”。 using
1) 我已经通过 my computuer -> System variables; 设置了变量 CLASSPATH 2) 重新启动控制台并键入 echo %CLASSPATH%,CLASSPATH
我已经看过这篇文章了PHP doesn't see mysql extension ,但这对我没有帮助。 我使用: Windows Seven(在虚拟机中为 32 位,在真实电脑上为 64 位) 带
当我尝试通过输入 python3 来验证 Python3 是否可以看到 Django 时其次是 import django进入终端(这样我就可以打印 Django 的版本号),我得到以下错误: Tra
我已经使用 easy_install 安装了 pygraphviz但是当我启动 python 时出现错误: >>>import pygraphviz as pgv Traceback (most re
在向 Microsoft 报告之前,我想在这里问一下。我有一个问题,我无法看到我的 WinUI 3 应用程序的实时可视化树。我什至看不到应用程序内工具栏。我可以在 WPF 和 UWP 应用程序中看到,
我对缺乏基本的了解和 内。 我希望看到 39 个 svg 子元素,100 像素高,每个子元素中都有清晰的文本。 http://jsfiddle.net/pn5sj8ge/ 最佳答案 发生这种情况的原因
我正在尝试设置一个新的持续集成服务器,该服务器利用 Phing 和 PHPUnit 自动运行测试用例。 我已经用 Pear 安装了 Phing: pear channel-discover pear.
lua -e "print(package.path)" ./?.lua;/usr/share/lua/5.1/?.lua;/usr/share/lua/5.1/?/init.lua;/usr/lib
我刚刚从 https://github.com/llvm/llvm-project.git 安装了 clang++ 和 libc++ .尝试运行时: clang main.cpp -stdlib=li
我一直在使用 Highstock 图表,我注意到当图表中有很多点时,无法使用工具提示查看最后一个点: 您可以看到工具提示显示了 5 月 9 日的点,而还有一个显示 5 月 10 日的点(正如您在范围选
This question already has answers here: error_log message is truncated when using print_r (5个答案) 1年前
我在编写 Selenium 测试来检查我的应用程序时遇到问题。我想测试的是,当用户输入正确的登录名/密码时,会显示正确的页面并且用户已登录。 主要问题是我的登录表单是作为 AngularJS 指令生成
我正在尝试在 Azure 服务上发布我的 ASP.NET Core 应用程序。这有效,但是当我尝试使用应用程序功能时,我收到消息 Your App Service app is up and runn
在我的 ionic 应用程序中,我有一个功能,用户应该在应用程序的导航栏中看到水平点线,单击它们,然后应该出现一个弹出菜单,其中包含两个菜单项(添加到收藏夹并添加评论)。下图说明了我的观点。 问题是这
我是一名优秀的程序员,十分优秀!