filipealva / PickerView

🔸 A customizable alternative to UIPickerView in Swift.
MIT License
527 stars 92 forks source link

How do I reload any picker view? #22

Closed kunass2 closed 7 years ago

kunass2 commented 8 years ago

Is there a way to refresh number of rows?

aminiz commented 7 years ago

For this particular library, you can use: pickerView.tableView.reloadData()

kunass2 commented 7 years ago

ok, thanks

y4nnick commented 7 years ago

I can't call the reloadData Method:

If gives me a Ambiguous reference to member 'tableView(_:numberOfRowsInSection:)' with the code self.setsBpreset.tableView.reloadData()

Is there a way to call it?

filipealva commented 7 years ago

Hi @y4nnick!

On the latest release I made tableViewa fileprivate property of PickerView and forgot to add a method to expose the ability to reload the picker. I'll fix it and release a new version later today.

Thank you for reporting!

y4nnick commented 7 years ago

Thanks for the quick response and this cool custom view. Looking forward to the new version!

filipealva commented 7 years ago

@y4nnick You're welcome. I'm happy you liked it :)

Man, I'm really sorry but I can't release the version today as I said. Today was a big release day in my company and could not dig into it because of that (now is 12AM here and I just stopped working, hehe)

I'll release it early tomorrow.

filipealva commented 7 years ago

Hey @y4nnick, it's deployed!

Sorry again for the delay. Please let me know if everything is working properly.

captura de tela 2017-03-26 as 22 28 43

y4nnick commented 7 years ago

Thanks, i will test it today and let you know :)

y4nnick commented 7 years ago

How can i use the new version? It seems that the pod is not found. I added pod 'PickerView', '~> 0.3.1' to my Podfile

bildschirmfoto 2017-05-02 um 18 25 14

y4nnick commented 7 years ago

I also cleaned the pod cache and tried to remove it from Podfile and inserting it again.

filipealva commented 7 years ago

Did you tried running "pod repo update" command and then running "pod install" again?

It should solve this issue

Em ter, 2 de mai de 2017 às 13:28, Yannick notifications@github.com escreveu:

I also cleaned the pod cache and tried to remove it from Podfile and inserting it again.

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/filipealva/PickerView/issues/22#issuecomment-298687394, or mute the thread https://github.com/notifications/unsubscribe-auth/AF1XoAm7xXM9sL7vxqZoOxzlCP0IWp2Aks5r11megaJpZM4LB4YC .

y4nnick commented 7 years ago

Thanks for your quick response! Now i have the right version.

Sadly the picker views still not reload correctly:

screen shot 2017-05-02 at 19 09 17

My Code for reseting: pointsApreset.reloadPickerView() setsApreset.reloadPickerView() pointsBpreset.reloadPickerView() setsBpreset.reloadPickerView()

pointsApreset.currentSelectedRow = 0 setsApreset.currentSelectedRow = 0 pointsBpreset.currentSelectedRow = 0 setsBpreset.currentSelectedRow = 0

I also tried it with self.pointsApreset.setNeedsLayout or self.pointsApreset.setNeedsDisplay but still the same result.

y4nnick commented 7 years ago

It seems that the correct number gets selected (bold font) but the scrolling position doesn't get reseted.

y4nnick commented 7 years ago

@filipealva any ideas? :)

filipealva commented 7 years ago

@y4nnick I'm not able to reproduce this issue :( can you provide a project with the example of this scenario so I can verify?

thanks