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

Don't show Photo area if... #4

Open
SaifAlDilaimi opened this issue Jul 25, 2014 · 2 comments
Open

Don't show Photo area if... #4

SaifAlDilaimi opened this issue Jul 25, 2014 · 2 comments

Comments

@SaifAlDilaimi
Copy link

thx first for this awesome project!

I would like to hide and move up the text area if there's no Photo. How can I do that?

@jessearmand
Copy link
Contributor

What you can do is modify STXFeedTableViewDataSource, and examine the two methods of UITableViewDataSource protocols tableView:numberOfRowsInSection: and tableView:cellForRowAtIndexPath:.

Here, I always return NUMBER_OF_STATIC_ROWS + commentsCount as the number of rows. You need to retrieve the postItem, check whether there's a photoURL or not. If there's no photo, then you need to use NUMBER_OF_STATIC_ROWS - 1

However, this is still not an elegant solution, because of the number of static rows that's not based on whether a content is available or not. Probably, it's better to create a method to calculate rows based on the properties of the photoItem.

Then at tableView:cellForRowAtIndexPath: you can also do the same checking mechanism on photoItem, and return the appropriate cell for each row.

Also make sure all the tableview datasource and delegate methods are properly checking for the postItem content on each indexPath.

@SaifAlDilaimi
Copy link
Author

Damn... Can you give me a example what do you mean with creating a method that calculates rows based on the properties? And how to reuse that on the other methods??

What do I have to do to add my own properties or another class to the existing ones post,comments and user. I have a channel class with 3 properties that I have to add also.

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