0
我正在配置UITableViewCell。设置UILabel字体大小,移动框架左边的文字
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];
问题是设定文本显示用负左边距文字的字体大小时,所以在帧中的X坐标之前开始。
如果我评论字体大小指令:
mainLabel.font = [UIFont systemFontOfSize:13.0];
的文本显示到位。
这是怎么发生的?
你是对的,以为我在测试了。我什至不记得为什么我添加该行代码。 – 2012-02-22 11:38:04