uias / pageboy Goto Github PK
View Code? Open in Web Editor NEW๐ A simple, highly informative page view controller
License: MIT License
๐ A simple, highly informative page view controller
License: MIT License
Add iOS 11 support for Pageboy
and Pageboy-Example
projects.
ViewController's statusbarStyle does not work on PageboyViewController.
Hi,
Is it possible to show transition while switching the pages?
Thanks
Add a bounces
property to the page view controller to allow for configuration of whether it should bounce at the end of page ranges. Suggested in #18
Add Swift 4 support for Pageboy
and Pageboy-Example
projects.
@msaps
Hey, I'm just curious about this. I have the snapchat like layout with a ParentVC and 3 ChildControllers.
I notice though if I have network requests in viewDidLoad
of VC's that arent my 'defaultPageIndex', scrolling to them causes a lag/freeze in my UI until the request completes.
For instance. given VC [1,2,3] where defaultPage is VC2
I have network code in my defaultPage which works fine. But when I scroll to VC1, both VC1 and VC3's viewDidLoad fires. So while VC3 is not in view, its performing network requests and updating UI which causes a lag and other times outright freeze. This despite the fact that the code is running in the background. So how can I solve this problem with this layout?
1?. Use a singleton to handle network requests and only update UI when Page comes into view?
2?. Or Only perform network requests in ParentView then update Page UI when it comes into view?
This question was posted by mistake.
Hi Dear
How you can support iOS 8
Hello. I have found retain cycle between PageboyViewController and PageboyAutoScroller. They keep each other in loadView method. Could you make handler property in PageboyAutoScroller as weak? Thank you.
open override func loadView() {
super.loadView()
self.autoScroller.handler = self
self.setUpPageViewController()
}
@msaps
This is more of a question as I wrap my head around how PageBoy
is structured.
For Instance I currently use EzSwipeController
and I'm looking to completely transition to this library. I currently have a storyboard with my two view controllers left & right
and that library goes to work to put them into the swipe navigation while my storyboard stays intact.
With pageboy, is it one super viewcontroller (PageBoyViewController) controlling all pages or can each page be controlled by its own viewController
? How?. If yes, would those viewControllers
still have access to their lifecycle methods viewDidLoad, viewDidAppear e.tc.
I know may pageview libraries lack this basic functionality.
if the Q's appear basic its Lack of deep familiarity with scrollview to be honest.
Hi,
Any chance of adding a way to set the delaysContentTouches variable of the scrollView in PageboyViewController? It doesn't seem that the scrollView is publicly accessible and I don't see a way I can override for child ViewControllers.
Something like adding:
public var delaysContentTouches: Bool = true {
didSet {
self.pageViewController.scrollView?.delaysContentTouches = delaysContentTouches
}
}
Thanks for a great library!
The current way of loading a PageboyViewController
with view controllers requires them all to be initialised in one go, which is expensive and probably not so great with larger numbers of pages.
PageboyViewControllerDataSource
should be redesigned to better support view controller reuse and improve its memory/performance footprint.
When in-call StatusBar/hotSpot StatusBar is present (On device, havent tried simulator), the following auto-layout errors are given by the compiler.
This can be recreated on the pageboy example app by just turning on personal hotspot and launching the app on device.
2017-05-30 11:51:07.328140+0300 Pageboy-Example[2099:469758] [LayoutConstraints] 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)
(
"<NSAutoresizingMaskLayoutConstraint:0x170098ba0 h=-&- v=-&- _UIPageViewControllerContentView:0x100d08a20.midY == UIView:0x100d12150.midY + 20 (active)>",
"<NSAutoresizingMaskLayoutConstraint:0x170098bf0 h=-&- v=-&- _UIPageViewControllerContentView:0x100d08a20.height == UIView:0x100d12150.height (active)>",
"<NSLayoutConstraint:0x170096a80 V:|-(0)-[_UIPageViewControllerContentView:0x100d08a20] (active, names: '|':UIView:0x100d12150 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x170096a80 V:|-(0)-[_UIPageViewControllerContentView:0x100d08a20] (active, names: '|':UIView:0x100d12150 )>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2017-05-30 11:51:07.334525+0300 Pageboy-Example[2099:469758] [LayoutConstraints] 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)
(
"<NSAutoresizingMaskLayoutConstraint:0x170098ba0 h=-&- v=-&- _UIPageViewControllerContentView:0x100d08a20.midY == UIView:0x100d12150.midY + 20 (active)>",
"<NSAutoresizingMaskLayoutConstraint:0x170098bf0 h=-&- v=-&- _UIPageViewControllerContentView:0x100d08a20.height == UIView:0x100d12150.height (active)>",
"<NSLayoutConstraint:0x170096e40 V:[_UIPageViewControllerContentView:0x100d08a20]-(0)-| (active, names: '|':UIView:0x100d12150 )>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0x170096e40 V:[_UIPageViewControllerContentView:0x100d08a20]-(0)-| (active, names: '|':UIView:0x100d12150 )>
Make a symbolic breakpoint at UIViewAlertForUnsatisfiableConstraints to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
I've tried 2.0 beta.2.
Thank you for redesign data sources!
So, I can improve performance.
But, I have a question(opinion).
PageboyViewController.currentViewController will return ViewController from dataSource's method in currently.
This behavior will return the wrong instance of ViewController depends on dataSource's implementation.
I think that it should return displaying ViewController.
What do you think?
whille installing 'Pageboy' using cocoapods i faced this issue.
bellow is my podfile,
# Uncomment the next line to define a global platform for your project
# platform :ios, '9.0'
source 'https://github.com/CocoaPods/Specs.git'
target 'demoPaging' do
# Comment the next line if you're not using Swift and don't want to use dynamic frameworks
use_frameworks!
pod "Pageboy"
pod "LXPageViewWithButtonsViewController"
# Pods for demoPaging
target 'demoPagingTests' do
inherit! :search_paths
# Pods for testing
end
target 'demoPagingUITests' do
inherit! :search_paths
# Pods for testing
end
end
please help.
Use Fastlane for building Pageboy, and configure to allow for automated releases.
When iOS 8 support was added, a fallback was not added for Right-to-Left localisation in iOS 8.0. See LocalizationUtils.
Is there a good way to trigger scrollToPage
from within a controller contained in the page view controller? For example, If I had a next button, what is the best way to trigger scroll to page on the enclosing PageboyViewController
?
The closest I got was the following:
func nextButtonPressed() {
if let pageboy = self.parent?.parent as? PageboyViewController {
pageboy.scrollToPage(.next, animated: true)
}
}
This works seemingly at random ( not on all vcs in the pageboy vc array for example. )
What is the correct way to implement this?
Apologies if I missed this, but it seems like there's no way to supply the third argument (options
) for a PageboyViewController
. This is really the only way to add space between pages via the UIPageViewControllerOptionInterPageSpacingKey
option key.
Maybe initial support could be provided with an API similar to navigationOrientation
?
public var interPageSpacing : CGFloat = 0 {
didSet {
guard self.pageViewController != nil else { return }
self.setUpPageViewController(reloadViewControllers: false)
}
}
This is an incredible library (thank you!) but the inability to specify space between pages is a bit of a dealbreaker right now. ๐ญ
@msaps
Hi...,
i want to track the user current touch index, its possible ?
if there means let me know
Is there a way to control or set a custom scroll speed for the PageBoyViewController?
Update PageboyViewControllerDataSource
function syntax to latest Swift conventions. (Remove forPageboyViewController pageboyViewController
etc)
Add the ability to transition to pages animated.
I'm using Tabman lib, which is depended on Pageboy
How to recreate
Select the last item, just try to do swipe gesture a couple of times to the left, then tap on the first item button. the scroll will not move.
When I debug I found, In below method it returns true even though the scroll is not visually moving.
PageboyViewController.swift
/// Whether the page view controller is currently being dragged.
public var isDragging: Bool {
get {
return self.pageViewController.scrollView?.isDragging ?? false
}
}
PageViewController display ViewController as full screen.
Therefore, Next or Previous ViewController should not be initialized when they before displaying.
But, Current DataSource APIs require all ViewControllers.
func viewControllers(forPageboyViewController pageboyViewController: PageboyViewController) -> [UIViewController]?
I think that add below API likes UICollectionViewDataSource.
Example,
func viewController(forPageboyViewController pageboyViewController: PageboyViewController, at index: Int) -> UIViewController
This API improves initialize performance when PageBoy has many viewControllers.
What do you think?
@msaps
As you know I have the current view hierarchy
-> ParentViewController
-> PageboyViewController
-> InvisibleViewController
-> RightViewController
In my right VC is a collectionView. When I click one of the cells, I segue to a modal view controller and get the warning Presenting view controllers on detached view controllers is discouraged...UIPageViewController
Not sure why since I added pageboy as a child controller on my parentVC. I dont have a problem present VC's from PageboyViewController itself.
It seems the cocoapods version is not the stable 1.0.0 :(
With pod 'Pageboy'
I get the following: Installing Pageboy (0.4.12)
I love the way this controller works, but I'm finding it difficult to make changes dynamically.
I need to be able to add & remove pages dynamically according to actions taken by the user. Let's say I load the pager with 3 pages, and in the second one the user taps a button. Then, I would have to add a new controller at the end. And maybe at some point the user does something and I have to remove the following page. That kind of things...
The thing is, from what I see, the pager loads pages when created using the delegate, and there is no way to dynamically add a new page 'on the fly'.
Is it possible to do so somehow?
Hello,
Is there way to make navigation same as here https://github.com/MerrickSapsford/MSSTabbedPageViewController ?
@msaps
This is another question/feature request.
I implemented Pageboy
and its working magically โจ -Easier to implement than I thought
I'd like to know if its possible for a Page
to transition above the next or previous like the image below. For my usecase, I have two pages. One has an ImageView background extending the bounds of the screen, the other is a tableView. A simple swipe transition is not that enchanting as it just pushes the VC out of the way. Im using infinite scroll.
Ive been playing around with interpolating the colors but its difficult since in my secondView with the background Image, the user is constantly changing their background Photo so its a masterful performance art to create smooth interpolations.
Snapchat offers a potential solution. Sliding above another Page so I can have one universal color interpolating effect instead of trying to match the varying colors of the BackgroundImage in my second Page (Hope I made sense)
In Tabman bar when user click Page No.5 from Page No.1, and use the func "scrollToPage(.at(index: index), animated: true)" will cause the screen to blink continuously.
This is caused by the setViewController animation.
But if I use scrollToPage(.at(index: index), animated: false) instead, the transition effect is low.
So I suggest optimize the scrollToPage for "func bar(_ bar: TabmanBar, didSelectItemAtIndex index: Int)" or add new func.
Maybe In page management only one scrollToPage func is not enough.
Add ability to enable infinite scrolling to PageboyViewController
scrollToPage()
in PageboyViewController
should return a bool
on whether the scroll was executed successfully.
I am only using the SnakePageControl
. I believe it has to do with the activeLayer
being lazy
because the only way for me to make the active indicator not be 5 points is to manually change the file's indicatorRadius
property within the SnakePageControl.swift
file itself.
@msaps Hi man
Here I am again ๐ ๐
I found another issue that is critical in my opinion. The "Tabman" or "Pageboy", I do not know exactly. However, you use some strong reference cause appear this issue.
For Simulate what happened to me. Please Use NavigationController
as application rootViewController
then push object which inherits from "Tabman" library.
After that back to rootViewController
of NavigationController
. The "Tabman" or "Pageboy" must be deallocated after pop TabmanViewController
or PageboyViewController
but never called deinit
Note: declare deinit
function in "Tabman" or "Pageboy" or A class inherit from both
deinit{ print("\(self)")
print self for debug log of the memory address.
Below delegate method will be called for even fraction change of the contentOffset
func pageboyViewController(_ pageboyViewController: PageboyViewController,
willScrollToPageAtIndex index: Int,
direction: PageboyViewController.NavigationDirection,
animated: Bool)
But there is no corresponding stop delegate method IF page index does not change.
In the example code, the previous and next buttons (button bar) are updated in by implementing above method, but if contentOffset is changed fractionally page does not change (index) therefore buttons (previous/next) would not update its enabled/disabled status.
Add support for tvOS targets.
Setting navigationOrientation
to .vertical
on a PageboyViewController
appears to be non functional and cause layout issues.
Reproducible by setting self.navigationOrientation = .vertical
in viewDidLoad
of PageViewController
in example app.
Add timer functionality to transition between pages
@msaps
Is there any plan to support pages on top or below?
Im looking to create a 3 page view [Left, Center, Top] where Top is above Left.
Also side question didnt want to raise issue but can bounce be disabled on First and Last page?
hello, i am trying to only let the user scroll to the next pages if they fill some data in each page. i also want to only let them go back if they change their minds but they cannot continue until something is filled in the current page. how can i achieve this?
Add improved localisation to support transitions when using right-to-left languages
It would be nice to be able to scroll by points.
I have a control that needs to scroll a pager but both need to be in sync so It works nice when I scroll the pager but when scrolling my own menu I can't pass the scroll offset to pageboy in order to scroll it.
I have a view controller (with pageboy) which is being present modally. I'm disabling the status bar manually:
override var prefersStatusBarHidden : Bool { return true }
The constraints of the parent view in VC is set to 0,0,0,0 (left,right, bottom, top respectively ). Now what I noticed is when Callin Status bar is triggered, the page view is pushed and there is 20 pixel empty space from the top.
Parent view is respecting constraints but pageboy somehow pushed.
Can you please help me with that?
Regards.
Currently the components used in PageboyViewController
are initialised in loadView
; this has potential issues when people want to use custom views for view controllers.
The initialisation code should be moved to a more suitable location in the lifecycle.
DataSource and Delegate should be weak
File PageboyViewController.swift
Line 27 should be
public protocol PageboyViewControllerDelegate: class {
Line 126 should be
public weak var dataSource: PageboyViewControllerDataSource? {
Line 133 should be
public weak var delegate: PageboyViewControllerDelegate?
PS: Sorry, haven't chance to create PR
didScrollToPageAtIndex is being triggered if other but separate table view is scrolled in the same view controller.
Data source and delegate of both, Pageboy and tableview, is set to self.
When I'm embedding a UITableView in a child view controller, I am unable to get vertical scrolling to work. Is there some API that I'm missing here? Should I be causing the underlying pan gesture recognizers to interact in some way?
How to pass data between pageboy ViewController
s?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.