Closed AaronLionsheep closed 6 years ago
For anyone else experiencing this issue, I have found a workaround. In my case I have 2 pages that I want to display. I add a 3rd page, just a UIViewController() to viewControllers. Then if the main view loads for the first time, I remove the last page from viewControllers, our dummy UIViewController(). This triggers some update which corrects the height of the very first view.
var initialized = false
override func viewDidLoad() {
super.viewDidLoad()
let notes = NotesTableViewController()
let setups = SetupsTableViewController()
viewControllers = [notes, setups, UIViewController()]
}
override func viewDidAppear(_ animated: Bool) {
super.viewDidAppear(animated)
if(!initialized){
viewControllers.removeLast()
initialized = true
}
}
@HackintoshMan Hi. I had same problem.
I reproduced bug in following branch with Example: https://github.com/ykeisuke/DTPagerController/tree/reproduce-bug
So, I fixed bug in PR: https://github.com/tungvoduc/DTPagerController/pull/26 If you needed, you can use my branch.
@ykeisuke Awesome! I'm looking forward to it being accepted. Sometimes you can see a glimpse of the empty UIViewController being added and removed with my workaround.
@ykeisuke @HackintoshMan Sorry took me long time to reply. I've got heavily sick and just recently recovered. I actually fixed this issue long time ago but I did not have time to publish new version. Please check version 1.0.7 I've just updated.
@ykeisuke Thank you for the PR, I will check if there is anything missing from my latest update.
@tungvoduc Awesome, I hope you get back to 100% health soon!
Also, did you mean version 1.1.7?
@HackintoshMan Yes I mean version 1.1.7
@HackintoshMan I will also publish new version 2.0.0 soon which supports custom segmented control however you want. It means you can use your own SegmentedControl or any 3rd party SegmentedControl.
Still having this issue, the first tableview controller has incorrect size, when i switch to another page and get back the height is right
@CarioniStefano Can you attach an example here?
When I initially load the view controller that contains my DTPagerController, the first view controller is always about half the height of the screen. As soon as I scroll to the next page, the height corrects itself. Interesting with the view (a tableview controller) does not update the height, only scrolling to a new page does. I've looked at through the code and I can't seem to find any work arounds. I've even tried to call
crollViewDidScroll(pageScrollView)
in my view did load to maybe try to trigger some code that updates the height, but it doesn't seem to help.