Arthur Camara Arthur Camara - 1 year ago 107
iOS Question

UITableView scrolls bounces back to top

I've been to a lot different questions on StackOverflow, But I just can't figure what is wrong here.
I have a view controller that receives data from a JSON, creating an array, and, then, it builds an UITableView, with fixed heights.
The issue is that I can't scroll to the bottom. It just bounces back.

- (UITableViewCell* )tableView:(UITableView*)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath{
static NSString *cellIdentifier = @"SettingsCell";
UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellIdentifier];
if (cell == nil)
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellIdentifier];

[cell.detailTextLabel setNumberOfLines:2];

NSDictionary* place = [_placesData objectAtIndex:indexPath.row];
[cell.textLabel setText:[place valueForKey:@"nome"]];
[cell.detailTextLabel setText:[place valueForKey:@"endereco"]];
[cell.detailTextLabel setLineBreakMode:NSLineBreakByWordWrapping];
[cell.detailTextLabel sizeToFit];
UIImage* originalImage = [UIImage imageNamed:@"encontre.png"];
UIImage* resized = [UIImage imageWithCGImage:[originalImage CGImage]scale:(originalImage.scale * 1.8) orientation:(originalImage.imageOrientation)];
cell.textLabel.font = [UIFont fontWithName:@"GillSans" size:17];
cell.textLabel.textColor = [UIColor whiteColor];
cell.detailTextLabel.font = [UIFont fontWithName:@"GillSans-Light" size:17];

[self.tableView setAlwaysBounceVertical:YES];
return cell;

I have no idea on what else to do. Already tried to set the
manually, force
on almost evert piece of code on the view controller.


Answer Source

Just managed to solve it, if anyone is having this same issue.

What I did is, inside the size inspector for my UiTableView, I manually set "Row Height" at 70 (the exact size I'm using).

After this, everything worked as a charm. But, if anyone can give a comprehensive explanation on what is really happening in here, it would be really great.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download