Home Features Docs Blog Support GitHub

How to add UITableViewAutomaticDimension for tableViewCells

(Sergey Sudnichnikov) #1

I am lost many time for search how to create custom cells with property UITableViewAutomaticDimension for TableViewCells in Java…
Please, help!)
Thank you!

(Eugene) #2

It is a tableView property. See apple docs at https://developer.apple.com/library/content/documentation/UserExperience/Conceptual/AutolayoutPG/WorkingwithSelf-SizingTableViewCells.html#//apple_ref/doc/uid/TP40010853-CH25-SW1

(Sergey Sudnichnikov) #3

hm, my question: how I can make it from Multi-OS-Engine (on Java).
I know how it works in objective-c/swift.

(Eugene) #4

What is the issue? You just call iOS API from Java. The API is still the same.

(Sergey Sudnichnikov) #5

For example,
public UITableViewCell tableViewCellForRowAtIndexPath(UITableView tableView, NSIndexPath indexPath) {
HashMap<String, String> row = this.data.get((int) indexPath.row());
String cell_template = “template_1”;
CustomCell cell = (CustomCell)tableView.dequeueReusableCellWithIdentifierForIndexPath(cell_template, indexPath);
if(cell_template == “template_1”){
// tableView.setEstimatedRowHeight(90);
// tableView.setRowHeight(UITableViewAutomaticDimension); <---- How do this
return cell;

(Eugene) #6


PS: I don’t think that is how auto-dimension supposed to work, e.g. check this code https://github.com/gklka/automatictableviewcellheight/blob/master/Proba/GKTableViewController.m