Giter Site home page Giter Site logo

Comments (15)

CyberMew avatar CyberMew commented on July 23, 2024

To reproduce, remove the unnecessary UI labels/imageviews from your row.

Remove the codes accordingly referencing those UI controls.

Use this code instead:

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath isExpanded:(BOOL)isExpanded
{
static NSString *CellIdentifier = @"Content1";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];

if (!isExpanded) //prepare the cell as if it was collapsed! (without any animation!)
{
    cell.textLabel.text = @"!expanded";
}
else ///prepare the cell as if it was expanded! (without any animation!)
{
    cell.textLabel.text = @"expanded";
}
return cell;

}

from hvtableview.

xerxes235 avatar xerxes235 commented on July 23, 2024

In this method:
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath isExpanded:(BOOL)isExpanded
isExpanded is supposed to be false because at app start up all the cells are initially collapsed. You should use these two delegates for setting up your cells in expand/collapse states:
-(void)tableView:(UITableView *)tableView expandCell:(UITableViewCell *)cell withIndexPath:(NSIndexPath *)indexPath
-(void)tableView:(UITableView *)tableView collapseCell:(UITableViewCell *)cell withIndexPath:(NSIndexPath *)indexPath

checkout the project's readme.

from hvtableview.

CyberMew avatar CyberMew commented on July 23, 2024

Hi, can you be more specific, because I took your project and it isn't working correctly. Could you please double confirm on your side using the instructions I have provided to reproduce the problem? I believe we are talking about 2 different things here. I am referring to the boolean inside cellForIndexPath being always false, i.e. the parameter is useless. I do not wish to touch expandCell/collapseCell because cellForIndexPath is sufficient for me needs (if the boolean parameter gets updated correctly)

from hvtableview.

xerxes235 avatar xerxes235 commented on July 23, 2024

You have misunderstood the usage of cellForRowAtIndexPath. This method is only called when the tableview tends to load a new cell or when you scroll. You get isExpanded = TRUE when you e.g. scroll down to an expanded cell. YOU MUST USE expandCell & collapseCell methods for setting your cell's state change animation. And also prepare your cell in cellForRowAtIndexPath according to isExpanded state.
cellForRowAtIndexPath is not called when you expand a cell. So don't expect it's isExapnded parameter to be set!!!

Please read the Apple documents carefully. This is about the basics of UITableView. And I assure you the project is already double checked from my side.

from hvtableview.

CyberMew avatar CyberMew commented on July 23, 2024

Hi, I understand that the cellForRowAtIndexPath is not called when you expand a cell.

You are misunderstanding what I am trying to say. Please do me a huge favor - add this to your cellForRowAtIndexPath function and let me know if it appears or not. Of course, do scroll the table to make sure it gets refreshed while in expanded state.
if(isExpanded)
NSLog(@"this line will not appear");

from hvtableview.

xerxes235 avatar xerxes235 commented on July 23, 2024
  1. In the example project add these lines immediately after
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifier];
if(isExpanded)
    NSLog(@"this line will not appear");
  1. Run the project.
  2. Scroll to bottom.
  3. Expand the bottommost cell.
  4. Scroll to top.
  5. Scroll to bottom again.

from hvtableview.

CyberMew avatar CyberMew commented on July 23, 2024

The log showed up for you? That is weird because it didn't for me. It didn't even enter the breakpoint.

from hvtableview.

xerxes235 avatar xerxes235 commented on July 23, 2024

zip your project and send it to my email: [email protected]

from hvtableview.

eugenesv avatar eugenesv commented on July 23, 2024

I wrote about this issue several days ago but you closed this topic.
This issue takes place in your example project, where method cellForRowAtIndexPath ALWAYS returns FALSE (NO), even if I will expand the cell.
You can make two breakpoints in cellForRow and you will see the issue.

from hvtableview.

CyberMew avatar CyberMew commented on July 23, 2024

Uploaded to your email, please check.

from hvtableview.

CyberMew avatar CyberMew commented on July 23, 2024

Were you able to download it?

from hvtableview.

xerxes235 avatar xerxes235 commented on July 23, 2024

Yes, I will let you know.

from hvtableview.

xerxes235 avatar xerxes235 commented on July 23, 2024

A pull request from gavyaggarwal was causing this problem when expandOnlyOnceCell was FALSE; you were right. I have pushed a new commit with the bug fixed. Thanks for your report.

from hvtableview.

CyberMew avatar CyberMew commented on July 23, 2024

Fix confirmed. Adding expandedIndexPaths = [NSMutableArray new]; to init fixes the problems. I skipped out on integrating this to my project because of the time taken. I hope this is a good lesson for not ignoring user reports and actually test them out. This will not go well with customers in the real world, though you actually get paid for it there and not here. Good job, I appreciate the followup. Will use it in the future :)

from hvtableview.

xerxes235 avatar xerxes235 commented on July 23, 2024

As I said the problem was due to a pull request from gary something. I didnt have enough time to scrutinize every pull request; and I was confident because my commits were working without this bug. However thanks for your report and I will try to spend more time on merging people's pull requests.

Sent from my iPhone

On Sep 15, 2014, at 7:42 AM, CyberMew [email protected] wrote:

Fix confirmed. Adding expandedIndexPaths = [NSMutableArray new]; to init fixes the problems. I skipped out on integrating this to my project because of the time taken. I hope this is a good lesson for not ignoring user reports and actually test them out. This will not go well with customers in the real world, though you actually get paid for it there and not here. Good job, I appreciate the followup. Will use it in the future :)


Reply to this email directly or view it on GitHub.

from hvtableview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.