S
S
Sergey Kiselev2014-02-26 23:37:02
iOS
Sergey Kiselev, 2014-02-26 23:37:02

Automatic resizing of TableView?

Tell me how to implement, if possible, then as detailed as possible, examples from stackoverflow do not work.
Dynamic cell resizing is implemented as
- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath {
CGSize size = [[[self vozvratmassiva] objectAtIndex:indexPath.row]
sizeWithFont:[UIFont systemFontOfSize:15]
constrainedToSize: CGSizeMake(260, CGFLOAT_MAX)];
double commonsize = size.height;
...
return commonsize;
}
Working without using storyboard

Answer the question

In order to leave comments, you need to log in

[[+comments_count]] answer(s)
S
s0L, 2014-02-27
@s0L

vozvratmassiva is a shame. As for the table, in order to change the size of the cell, it must be reloaded via reload of the cell or the entire table, without this nothing will happen.

I
IURIA, 2014-02-27
@GxocT

What exactly are you having problems with?
If you have UITableView *tableView, then you can change its size by changing tableView.frame or tableView.bounds.
Accordingly, in the code you calculate the required table size and set it. In your case, as far as I understand, it should be equal to the sum of the heights of all cells?!
Well, here's a simple example that resizes a table on the click of a button.
1. We create an application with a single ViewController and xib file.
2. Add UITableView to xib.
3. Bind the table's delegate and dataSource properties to the File's Owner.
4. We create a @property tableView class and associate a table with it in our class.
5. Next, use this code: pastie.org/8800027
In the code, I am creating two buttons, one is zooming out the table and the other is zooming in.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question