我有在具有一个UILabel作为一个子视图,当我设置标签的文本表视图细胞时,它决不会在细胞中。我有点在iPhone开发一个小白,我不知道我做错了什么......UITableViewCell中的UILabel子视图不显示。 (iPhone开发)
我创造,在我的表视图的委托的cellForRowAtIndexPath返回以下细胞:
cell = [[[ActivityCell alloc] initWithFrame:
CGRectZero reuseIdentifier:ColumnedCell] autorelease];
CGRect frame = CGRectMake(180.0, 11.0, 130.0, 22);
UILabel *valueField = [[UILabel alloc] initWithFrame:frame];
[valueField setAutoresizingMask:UIViewAutoresizingFlexibleLeftMargin];
valueField.tag = 111;
valueField.textAlignment = UITextAlignmentRight;
valueField.textColor = [UIColor colorFromHex:@"326799"];
valueField.highlightedTextColor = [UIColor whiteColor];
valueField.baselineAdjustment = UIBaselineAdjustmentAlignCenters;
valueField.adjustsFontSizeToFitWidth = YES;
[cell.contentView addSubview:valueField];
[valueField release];
cell.selectionStyle = UITableViewCellSelectionStyleNone;
我再想以后通过这样设置的UILabel(子视图)(我目前在viewDidAppear此代码):
ActivityCell *cell = (ActivityCell*)[formDetailsTableView cellForRowAtIndexPath:
[NSIndexPath indexPathForRow:0 inSection:1]];
UITextField *valueField = (UITextField *)[cell viewWithTag:111];
valueField.text = @"foo";
但这个词“富”一直没有出现在U ILabel。我相信,它显示了当我< = 2.2 SDK编译,但我想要得到这个与3.0+
为什么文本显示不出来任何想法的工作?
跟进:
请看看这个问题,作为跟进这个:UITableViewCell's textLabel is overlapping a subview label, how can I fix it? (iPhone Dev)
没有运气好的话,valueField.text看起来像它的设置(通过NSLog的),但它不会在视图中显示出来。 – mmattax 2009-12-28 20:04:37