I’m configuring a UITableViewCell.
mainLabel = [[[UILabel alloc] initWithFrame:CGRectMake(0, 8, 226, 14)] autorelease];
mainLabel.tag = MAINLABEL_TAG;
mainLabel.font = [UIFont systemFontOfSize:13.0];
mainLabel.textColor = [UIColor darkGrayColor];
mainLabel.autoresizingMask = UIViewAutoresizingFlexibleLeftMargin | UIViewAutoresizingFlexibleHeight;
mainLabel.backgroundColor = [UIColor clearColor];
[cell.contentView addSubview:mainLabel];
The problem is when setting the text font size the text is displayed with a negative left margin, so it starts before the X coordinate in the frame.
If I comment the font size instruction:
mainLabel.font = [UIFont systemFontOfSize:13.0];
The text is displayed in place.
Why is this happening?
remove this line