-
-
Notifications
You must be signed in to change notification settings - Fork 240
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do I go directly to second or third tab when coming to the parent vc? #259
Comments
Hi, Create This Method in TabmanViewController class and add below method Example
Usage: Hope this will Help |
@junweimah are you wanting to set a default page index when the view controller is loaded, or moving within the page view controller after doing something in one of the child screens? |
I want to do this
I already successfully done it by using this line :
|
Hey, after some progression of my project, I found that I need to go to a specific page when I first enter the parent vc, which is what you said here :
But I want to control it dynamically, which means I need to do some checking before I decide which page to go |
@junweimah this can be achieved with the func defaultPage(for pageboyViewController: PageboyViewController) -> PageboyViewController.Page? {
return .at(index: 2)
} |
This code works, but the indicator remains at the first tab when I land on my parent vc, how do I set it to whichever index I want? |
@junweimah this could be a bug, are you saying that the tab bar doesn't respect the default page? |
Yes. For example after some checking, i want user to go to page 3, yes it indeed landed on page 3, but the indicator remains at page 1. |
@junweimah how are you trying to achieve this? The |
This is my exact code at parent vc :
In this case i only have 3 tabs to choose where to go to. |
@junweimah the |
Same thing happens I have changed my code to this :
I landed on page 3, but the indicator is still at page 1 |
I check the example project, and i find that it is working using The difference I am seeing between the example and mine are In example project, you have this :
In my project, I have this :
where viewCustomBar is a UIView outlet dragged from storyboard for my bar to embed in. Could this be the reason causing the bug? |
Yes it is confirmed. I changed my codes to this :
Now he default page works as intended. But for some reasons I have to use my previous code, which are
Can you kindly fix this bug? |
@junweimah I can't seem to reproduce it, even with the bar embedded in an external view. Could you provide a demo project which reproduces it? Would be much appreciated! 🙂 |
Ok I will try to reproduce for you to test. By the way in the meantime do you test out with 3 or 4 child vc? Something like this : '
` |
I HAVE FOUND THE PROBLEM!!!!I solved it in my project, this is the things that I have changed : I commented off these lines
and used these lines like in the demo project : I added :
And that's it. That's all I changed to remove the bug. But however I still cannot reproduce the bug using the demo project even reversing what I did to solve the bugI try using
and commenting off
Both way works in the demo. I dont know which part trigger the bug in my project. Anyway thanks for the help. |
After solving this bug, I found another bugI'll open another issue. |
So I have some checking before bringing user to the parent's vc which holds all the tabs.
So lets say in parent tab, I have 3 tabs.
After user is done doing something in a previous screen, I want to bring user to the second tab, how do I open the parent's vc and directly lands user in the second tab?
Thanks
The text was updated successfully, but these errors were encountered: