In my application I have few views with longer text. In my detail view I have been imported text from database and for some short texts it works but for longer it make me problem. When I take smaller font it shows me all text so it loads it from database good but make some other problem. My code for that part is:
case RestaurantItemTypeDescription : {
cell = [tableView dequeueReusableCellWithIdentifier:@"Restaurant Description"];
if (cell == nil) {
cell = [[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:@"Restaurant Description"];
}
cell.imageView.image = nil;
cell.selectionStyle = UITableViewCellSelectionStyleNone;
CGRect rectLabel = CGRectMake(cell.frame.origin.x+20, cell.frame.origin.y+10, cell.frame.size.width-20, cell.frame.size.height-20);
UILabel* label = [[UILabel alloc] initWithFrame:rectLabel];
label.lineBreakMode = UILineBreakModeWordWrap;
label.numberOfLines = 0;
label.font = [UIFont fontWithName:@"Helvetica" size:13.0]; //Same font used for calculating height
label.text = item.itemText;
label.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
[cell addSubview:label];
// [label release];
//NSLog(@"description=%@", item.itemText);
cell.accessoryType = UITableViewCellAccessoryNone;
break;
}
I have autoresize atribute but it seams it doesn't work.
Can someone please tell me what to do? I was searching the web and it seams that there is no restriction about size of text in view. Thanks...