Git Product home page Git Product logo

pageboy's People

Contributors

ahmedk92 avatar anlaital avatar basbuijsen avatar chorim avatar christiansteffens avatar cmolyneux avatar coeur avatar dependabot[bot] avatar dev-yong avatar emilwojtaszek avatar farshadmb avatar jiro33 avatar lpizzinidev avatar lukaskollmer avatar mlarandeau avatar msaps avatar muukii avatar patrick-remy avatar ramblinwreck77 avatar ricobeck avatar soheilbm avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pageboy's Issues

Func scrollToPage use for Tabman didSelectItemAtIndex will cause the screen to blink continuously

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.

Space has been added while call in bar active but now shown

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.

Unable to find a specification for `Pageboy`

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.

Cocoapods version outdated

It seems the cocoapods version is not the stable 1.0.0 :(
With pod 'Pageboy' I get the following: Installing Pageboy (0.4.12)

Support for Page on Top & Below

@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?

Have page transition above Next or Previous Page (Z-Index)

@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)
img_4585

Refactor PageboyViewController initialisation code

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.

Even though scrollview is not scrolling isDragging method returns true

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
        }
    }

Redesign PageboyViewControllerDataSource for reuse

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.

Is really nice how you have didScroll to and passing the offset.

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.

Trigger scrollToPage from a controller within the PageBoyViewController.

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?

delaysContentTouches on scrollView

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!

Autolayout errors when in-call statusbar is visible

@msaps

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.

shouldScrollAtPage request

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?

[2.0 beta.2] PageboyViewController.currentViewController should not call datasource method.

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?

Is it possible to add pages dynamically ?

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?

Setting navigationOrientation to vertical does not work

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.

Embedding UITableView in Pageboy

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?

Presenting on detached view controllers is discouraged

@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.

Add support for initialization options

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. ๐Ÿ˜ญ

[Improve Performance] ViewController for PageViewController should be initialized lazily

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?

Strong And Weak Reference Issue (MemoryLeak)

@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.

Retain cycle

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()
    }

Memory leak

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

New feature request

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.

Best place to put network code?

@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?

Managing Multiple Pages

@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.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.