Open thomaaam opened 7 years ago
I managed to work around this by adding a protocol for hiding the pagingControllers
until the defaultPage
controller was done loading and being shown on screen. This (partly) works, but I still have to wait briefly before the defaultPage
controller is being shown at all, leaving me with this void for a short duration. I want the behaviour to equal the behaviour I get when lazyLoadingPage=.one
, only that I can swipe sideways as soon as my left and/or right "pagingControllers" are done loading.
This seemed to be a life cycle issue. Calling the setup of the PagingMenuController
instance below super's viewDidLoad
rather than super's viewWillAppear
fixed this issue.
@kitasuke I have the same issue and am also using four view controllers, except I left the defaultPage
var at 1
. @thomaaam's fix didn't work for me.
The problem is the PagingMenuController
always shows the last view controller first, however, the text that's displayed, underlined in the center of the menu is the defaultPage's
menu title , but the view controller that's actually shown is the fourth view controller.
When I swipe to the right during this inconsistency, the menu item changes to the fourth view controller's title, but the view controller itself doesn't move at all, so afterwards, the fourth view controller is shown with its menu title, and it continues to work properly after that.
But if I instead swipe to the left, then the opposite happens, the view controller changes to the first view controller, and the menu item doesn't change at all, so afterwards, the first view controller is shown with its menu title, and it continues to work properly after that.
@kitasuke I'm also finding that no matter what I set the defaultPage
to, when the PagingMenuController
loads, the current menu item title correctly displays the defaultPage's
title, but the view controller that's shown with it is always the view controller that's to the left of the defaultPage
. The PagingMenuController
always begins working properly after a single swipe is made to either the left or the right.
I'm finding the issue is in this method:
class PagingViewController: UIViewController {
internal func positionMenuController() {
if let currentViewController = currentViewController, let currentView = currentViewController.view {
contentScrollView.contentOffset.x = currentView.frame.minX
}
}
}
The frame of the currentViewController
is all zeroes. How I'm creating the PagingMenuController
is through interface builder. I have a view controller with a corresponding .xib
file, I add the PagingMenuController
to the view controller's .xib
file, create an outlet for the PagingMenuController
in the view controller's swift file, and link the PagingMenuController
to it.
Doesn't matter whether I setup the PagingMenuController
in my controller's viewDidLoad
, viewWillAppear
, or viewDidAppear
, the issue persists.
Expected behavior and actual behavior I expect that when using
defaultPage
that the corresponding page always loads first without the interference of neighbouring pages (on either left or right side). The current behaviour (when loading page index 2 of 3) is that the fourth page (with index 3) is first loaded and then it jumps back to the page with index 2; it should always stay on index 2.Steps to reproduce the problem Create a PagingMenuController with four
pagingControllers
that loads some data into their views, then setdefaultPage=2
. If you see that the menu item which corresponds to the fourth page is shown before the menu item of the third page, you have reproduced it.Specifications like the version of the project, library, or Swift PagingMenuController version 2.2 and Swift version 3.0.2 EDIT: I use the following
PagingMenuControllerCustomizable
properties:I have tried to "hack" some custom solution for it, but I always seem to end up very briefly showing the fourth page.