Giter VIP home page Giter VIP logo

expandablecellsexample's Introduction

ExpandableCellsExample

###Simple example of how to create expandable table view cells

Expandable Cells Icon

In this example, I show one of the possible ways to create expandable table view cells. What seems to be such an easy task, and present in many applications and customer requirements nowadays, is usually taking too much effort for developers to code, so I thought of a simple way to solve this problem.

I needed to create a simple expandable table view cell and found out that all the libraries that were dealing with this problem, were either not functional or didn't work on latest environment.

Note that this source code is not a "ready-to-go drag-and-drop" framework. It just shows you one possible way of creating expandable cells.

##Features

  • Expandable Table View Cells
  • Dynamic table view cell height, which depends on the text view content height
  • Auto-resize table view cell upon user interaction on text view content
  • Keeps cursor always on focus

The technique used in this example is simple: load everything that you need to be displayed in that given cell, at once (not lazy instantiation). Set the cell height to a determined collapsedCellHeight. Then, upon user interaction, expand that cell height to the expandedCellHeight (actually calculate the cell height, and not use a constant).

There are many other solutions to this issue, like lazy instantiation (load the expanded cell content upon user interaction - in case it displays content from a web service), or completely change the cell structure upon user interaction - each case depends on your needs. This is not the only solution.

#####Feel free to contact me for any questions, suggestions, pull requests, or anything doubts. @Rogerluan_ (Roger Oba)

expandablecellsexample's People

Contributors

rogerluan avatar

Watchers

 avatar  avatar  avatar

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.