Skip to content
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

Fails when setting selectedIndex #45

Closed
davidmichaelhogan opened this issue Jul 17, 2018 · 5 comments
Closed

Fails when setting selectedIndex #45

davidmichaelhogan opened this issue Jul 17, 2018 · 5 comments

Comments

@davidmichaelhogan
Copy link

Hi!

I'm trying to set self.selectedIndex to the middle option of my menu so I can swipe either way to get to the other views. Whenever I add self.selectedIndex the swipe function just seems to no longer work...

Any ideas would be greatly appreciated !

@marcosgriselli
Copy link
Owner

marcosgriselli commented Jul 17, 2018

Hi @cr-ks you need to update the selectedViewController property instead of the selectedIndex to trigger the gesture setup:

selectedViewController = viewControllers?[1]

@TomQDRS
Copy link

TomQDRS commented Jul 18, 2018

Do you plan on resolving this bug in the future? Considering setting "selectedIndex" is the usual practice when manually switching to a tab of a tabBarController, this seems like a rather important issue (I just ran into it myself about 10 minutes ago and almost opened a new issue beforeI saw this thread).

@marcosgriselli
Copy link
Owner

@TomQDRS just created a new issue for this #46

@wdurkee
Copy link

wdurkee commented Dec 10, 2020

Hi even when I use selectedViewController my app crashes.

I get this when I try to set as detailed in the example in the repository
Screen Shot 2020-12-09 at 3 48 07 PM

When I comment it out I get this warning
Screen Shot 2020-12-09 at 3 50 23 PM

Any clue to what might be going on? (Also thanks for this library its very useful!)

@marcosgriselli
Copy link
Owner

@wdurkee it seems like you're getting an unrelated problem. The first screenshot mentions that the NIB is not loadable and the second one that you're passing an invalid attribute to the 'User Defined Runtime Attributes' inspector on Interface Builder. Can you share the code so I can point to a possible solution? selectedViewController and selectedIndex both should work programmatically as expected. You can try both properties on the example app.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants