Git Product home page Git Product logo

Comments (3)

sunnyxx avatar sunnyxx commented on July 30, 2024

This is UITableView's "bug like" problem in iOS8 (not in iOS7), -tableView:heightForRowAtIndexPath: method will be called many times initially, and re-calculate when cell dequeues even you've scrolled through for more than one time, so this is why I provide a cacheByIndexPath API to avoid a mess of height calculations.
When I implement cacheByIndexPath, I found it's not easy to automatically invalidate caches when data source updates. So I used a tricky way, swizzled a private method who triggers reload ( -reloadData, -insertSection..,-deleteRows... ... all work) and clear all current caches, it's a bit more complex, but makes this cacheByIndexPath API quite easy to use, no need for manual invalidation calls. But it has the "3 times" problem as you pointed, because UITableView itself triggers reload for 2 more times at init when it's being moved to window and layout its subviews. It's hard to solve unless I put the invalidateCaches method public.

So I'm thinking a better solution.

from uitableview-fdtemplatelayoutcell.

sjapps avatar sjapps commented on July 30, 2024

Anything on this? I love the idea of this project and want to use it but without this iOS8 support, it kind of beats the purpose of it.

from uitableview-fdtemplatelayoutcell.

sunnyxx avatar sunnyxx commented on July 30, 2024

@sjapps Just use - (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath api for height calculation, it's iOS6+ and pure. New version's coming and I'll close this issue by then.

from uitableview-fdtemplatelayoutcell.

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.