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

issue with tabbar controller #64

Closed
DKalachniuk opened this issue Jan 3, 2019 · 5 comments
Closed

issue with tabbar controller #64

DKalachniuk opened this issue Jan 3, 2019 · 5 comments

Comments

@DKalachniuk
Copy link

I have a tabbar controller.
ViewController A with expandable table view inside
View Controller B without. Just empty one

I open A.
opened B
then Open A

expandable table view is not working and crashes

I reproduced this issue with demo app. Just embed in tabbarcontroller instead of navigation controller.
please help

@pikaboo
Copy link
Collaborator

pikaboo commented Jan 3, 2019

Hi,
Do you have a link to your reproduction code? So I may take a look?

Thanks,

@DKalachniuk
Copy link
Author

DKalachniuk commented Jan 3, 2019

no. But I can create a repo. 5 mins

@DKalachniuk
Copy link
Author

https://github.com/DKalachniuk/ExpandableCell

please take a look
Thank you

@pikaboo
Copy link
Collaborator

pikaboo commented Jan 3, 2019

Ok I found how to fix your problem:

Because of a memory leak in certain conditions, I added a flow to allow auto release of delegate - in some cases it is OK to have it auto released, i.e the screen will reload and the delegate will be reset automatically.

However, in your case, the screen doesn't reload - i.e viewDidLoad does not get called when you switch between tabs, so your scenario doesnt need the autoRelease of the delegate, you need to manage it yourself (i.e when to add it and when to remove it from the tableview).

so in your viewDidLoad add this code:
tableView.autoReleaseDelegate = false

and that way your delegate will get to live past viewWillMoveToWindow:nil

however, when you leave that screen - where the tabs are- to have completely disappear from memory, you'd need to make the delegate be nil yourself

@DKalachniuk
Copy link
Author

DKalachniuk commented Jan 3, 2019

it works! Thank you very much!

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

2 participants