我在我的应用程序中使用UIPageViewController,我想在其中有一些UIButtons,有点像菜单.我遇到的问题是,当我在屏幕边缘附近放置UIButton(或任何其他交互元素)并点击它时,而不是应用UIButton操作,会发生什么变化,页面会发生变化(因为边缘点击屏幕更改UIPageViewController上的页面).我想知道是否有办法使UIButton具有比UIPageViewController更高的优先级,这样当我点击按钮时,它会应用相应的操作而不是更改页面.
我有一个PageViewController,它初始化如下:
self.pageViewController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll
navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil];
Run Code Online (Sandbox Code Playgroud)
在其中一个页面上,有一个UISlider.
我的问题是,当我将过渡样式设置UIPageViewControllerTransitionStyleScroll为时beginTrackingWithTouch,在滑块上调用之前需要150-200毫秒.当我使用UIPageViewControllerTransitionStylePageCurlUISlider 时,立即选择此行为.
这意味着除非用户在拖动滑块之前等待一点(视频进度),否则页面将转向,这远非理想.
Page curl动画不符合应用程序的要求,因此任何解释或解决方法都表示赞赏.
我正在使用UIPageViewController,为我的应用程序进行产品导览.
我按照这个链接http://www.appcoda.com/uipageviewcontroller-tutorial-intro/
我正在做的是根据我获得的索引值在滑动时更改我的"根VC"的背景颜色的简单任务,但是由于委托函数被调用两次,我的索引值不正确,因此,我不是能够做对,下面是我的代码
#import "APPViewController.h"
#import "APPChildViewController.h"
@interface APPViewController ()
@end
@implementation APPViewController
- (void)viewDidLoad {
[super viewDidLoad];
self.pageController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options:nil];
self.pageController.dataSource = self;
[[self.pageController view] setFrame:CGRectMake(0, 0, 320, 500)];
APPChildViewController *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];
}
- (void)didReceiveMemoryWarning {
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (APPChildViewController *)viewControllerAtIndex:(NSUInteger)index { …Run Code Online (Sandbox Code Playgroud) 我正在构建一个复杂的项目,除其他外,我需要将UIPageViewController设置为主视图的子视图.我正在使用autolayout,并使用约束来命令主视图上的各种元素.
问题是,当我尝试运行应用程序时,由于NSAutoresizingMaskLayoutConstraints冲突而崩溃.
2013-10-28 16:22:18.419 Red Event App[1658:60b] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSLayoutConstraint:0x145c1990 V:|-(20)-[UINavigationBar:0x145bf6b0] (Names: …Run Code Online (Sandbox Code Playgroud) 我正在使用UIPageViewController来显示嵌入在子视图控制器中的图像.
NSDictionary *options = [NSDictionary dictionaryWithObject: [NSNumber numberWithInteger:UIPageViewControllerSpineLocationMin] forKey: UIPageViewControllerOptionSpineLocationKey];
self.pageViewController = [[UIPageViewController alloc] initWithTransitionStyle:UIPageViewControllerTransitionStyleScroll navigationOrientation:UIPageViewControllerNavigationOrientationHorizontal options: options];
self.pageViewController.dataSource = self;
self.pageViewController.view.frame = self.view.bounds;
ImageViewController *initialViewController = [self viewControllerAtIndex:0];
initialViewController.index = 0;
NSArray *viewControllers = [NSArray arrayWithObject:initialViewController];
[self.pageViewController setViewControllers:viewControllers direction:UIPageViewControllerNavigationDirectionForward animated:NO completion:nil];
[self addChildViewController:self.pageViewController];
[self.view addSubview:self.pageViewController.view];
[self.pageViewController didMoveToParentViewController:self];
Run Code Online (Sandbox Code Playgroud)
一切都很好,但我讨厌儿童视图控制器彼此相邻.

我想知道是否有办法在子视图控制器之间添加填充,这样它们就不会彼此相邻.
看起来更像是这样的东西:

我想在页面滚动过程中从uipageviewcontroller接收更新.我想知道%的transitionProgress.(当用户移动手指以进入另一页时,此值应更新).我对从一个页面到另一个页面的动画进度感兴趣,而不是通过总页数的进度感兴趣.
到目前为止我发现了什么:
有一个名为UICollectionViewTransitionLayout的类,它具有与我正在寻找的属性"transitionProgress"相对应的属性.可能uipageviewcontroller以某种方式实现这个方法?
我可以在uipagecontroller上调用以下方法,但结果只得到0!
CGFloat percentComplete = [self.pageViewController.transitionCoordinator percentComplete];
我UIPageViewController在我的应用程序中使用了一个.它工作得很好,但当我翻页时,下一页似乎在比屏幕大的框架中初始化:在翻页时,只有一部分视图viewController适合屏幕.
我正在初始化UIPageViewControllerin viewDidLoad并开始记录PageVC其子视图和框架parentVC.每一帧似乎都没问题,只有UIPageViewController's框架,我登录viewControllerAfterViewController的宽度几乎是屏幕实际尺寸的两倍.
我正在使用页面视图控制器来翻阅一系列视图控制器,每个视图控制器都是从故事板中实例化的.我基本上使用基于标准页面的应用程序代码作为基础,并构建了我需要的东西.我正在翻阅的UITableViewController视图控制器是包含自定义滚动视图的子类或自定义视图控制器.
页面视图控制器嵌入在导航控制器中,但是没有一个视图控制器遵循顶部布局指南,即使在我的自定义视图控制器的情况下约束被设置到故事板中的布局指南,我认为表视图控制器将自动管理它.我的意思是视图的内容从(0.0,0.0)开始,而不是用户可以看到的地方.唯一有效的是实际上将视图控制器视图的帧设置为在状态栏+导航栏下面开始,但我希望滚动视图在透明导航栏下滚动.
我做错了什么或不做什么?
我想在我的应用程序中添加一个教程UIPageViewController,但是我的应用程序没有使用故事板,你知道任何可以向我解释如何操作的教程吗?我一直在环顾四周,但一切都提到了故事板.
非常感谢.
ios ×8
objective-c ×4
cocoa-touch ×2
ios7 ×2
ios5 ×1
ios6 ×1
iphone ×1
storyboard ×1
transitions ×1
uislider ×1
xcode ×1
xcode7-beta4 ×1
xib ×1