Closed danielpassos closed 8 years ago
Hi @danielpassos, this is weird indeed. The page indicator should be visible by default. This issue could appear if the scroll view is not added to the main view in viewDidLoad
where you add the images. Here is why:
One person had a similar issue because the scroll view was not installed in the default size class, therefore it was not in the main view during the viewDidLoad
call.
This made the page indicator disappear:
I hope that helps. Let me know how it goes.
@evgenyneu
Thanks for the very awesome reply. The only thing come in my mind now, is this view controller is embedded in a Container View
.
Anyway, I will try to reproduce the same scenario in a clean/new app and play around tomorrow morning. I can publish it in my Github account and let you know here.
Thanks for the reply again!
The container view may be the cause. To do a quick check I would print the value of scrollView.superview
in the function where you show the images. If it's nil
then the page control will not be created. In this case, you may want to show the images after the scroll view is added to the view, in viewWillAppear, for example.
Yeap, it is the problem, but seems I have the same using viewWillAppear
swift
override func viewDidLoad() {
print("scrollView.superview = (scrollView.superview)")
}
scrollView.superview = nil
``` swift
override func viewWillAppear(animated: Bool) {
print("scrollView.superview = \(scrollView.superview)")
}
scrollView.superview = nil
I did the same scenario I have in the clean/new app and it works like a charm with the same code, so it's seem be a specific problem in my project. I'll investigate. Thanks for your help anyway
What I need to do to enable the page indicator? I cloud not find any reference about it in your demo app.