-
Notifications
You must be signed in to change notification settings - Fork 80
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
Reverse functionality #9
Comments
Hey there! Interesting idea – I honestly have never thought about putting a table view in anything other than a view controller. But yeah, I think your approach should work. Let me know if you run into trouble. |
Hi Ash, I seem to have completed this idea (visually) however it seems as though the nested tableView's delegate methods are not being called. Unfortunately I'm not able to post code (privacy issues) and obviously this would make it difficult for you to assist, however I was wondering if you have any thoughts on the matter ? |
I would set breakpoints/ |
my thoughts exactly - I placed 'print' inside the cellForRowAtIndexPath however this line is never executed hence making me think that the delegate method never gets called. |
Definitely, so next you should set a breakpoint where you're setting the delegate/datasource of the table view. |
You were right in assuming the table view delegate doesn't get set. It seems my collection view delegate method "willDisplayCell" that is executing the "setTableViewDataSourceDelegate" method is never executed (as found by break point). The only thought as to why is the warning's I receive:
|
Hmm. Your collection view delegate should implement the following method: - (void)collectionView:(UICollectionView *)collectionView willDisplayCell:(UICollectionViewCell *)cell forItemAtIndexPath:(NSIndexPath *)indexPath And in there, you can set the delegate/datasource of the table view. Does that make sense? |
Makes perfect sense - I'm already doing that. Within the delegate method i perform this method (similar to your tutorial)
|
Is the delegate method itself getting called? Keep testing your assumptions: somewhere in there, something is not behaving as you expect. With enough trial and error, you'll find it 😸 Ash Furrow
|
Never gets called no, which is what i was trying to get through. I have no clue why it doesn't get call, haha so weird. |
Double check that the collection view's delegate is getting set somewhere, either in a storyboard or in a view controller? |
Solved !!! Turns out - after the guidance of you last comment - even though i had the delegate and datasource set in the Storyboard and the datasource set in code, I still had to set the delegate in code on the collection view. Thank you for the assist, one last thing would be an explanation for all that. Is it common practice to have to set the delegate in code as you do with the data source ? For example.
When it comes to implementing a table view I'm only executing the datasource setting line. Thought this would be similar with collectionViews. |
Hmm, no it's typical to have to set both. I'm curious why it was working with the table view – maybe they were already set, and setting only the datasource again didn't have any effect? Not sure. Anyway, glad you got it figured out! 🎉 |
Not sure if i should open a new issue. But i have another issue. The table view cell's are acting normally when implementing the |
Hmm, honestly I'm not sure. Like I said, I've not used table views outside of the context of "this table view fills the entire screen"-style. I would double-check that the code works inside a table view project by itself first, to eliminate the possibility of an error there. If it works on its own, but not in a collection view cell, then something spooky is likely going on. |
Hi ash, just wanted to update you since you've been so helpful and I appreciate the time you have put into helping out. Turns out everything was working fine and the reason I couldn't click the 'delete' button even though the cell would slide right to left like normal was because the collection view bounds weren't correct and caused the table view cell to be displayed off the screen. Therefore when I would slide right to left the cell was acting accordingly however the delete button was displaying off the screen. Again, thanks again for the assist, it's looking to be a successful integration functionality wise of a collectionView with a nested tableView in the collectionView cell's. Best, Vince |
Awesome, glad everything worked out! I'm going to close this issue – feel free to re-open it or open a new one 🙇 |
Was wondering about doing the opposite of this and having a tableview nested inside a collection view cell. would it just be replacing the tableview delegates with the collection view and making the tableView delegates the extension of the class ?
The text was updated successfully, but these errors were encountered: