我是iOS新手,所以它可能非常简单。什么重要 - 我想使用绘图,而不是添加子视图。我需要用公开的方法来做。试图做到这一点,像这样:在UITableView中绘制文本 - 文字不显示
@implementation TripTableViewCell2
- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
if (self) {
// Initialization code
}
return self;
}
- (void)awakeFromNib
{
// Initialization code
}
- (void)updateWithTrip:(Trip*)trip
{
NSDictionary *attributes = @{NSFontAttributeName: [UIFont systemFontOfSize:10.0f],
NSForegroundColorAttributeName: UIColorFromRGB(0x28cdfb)};
CGSize textSize = [trip.tripId sizeWithAttributes:attributes];
CGPoint textPoint = CGPointMake(10.0f, 10.0f);
[trip.tripId drawAtPoint:textPoint withAttributes:attributes];
}
我想我会错过一些简单的像绘制,但不知道设置背景..此外,有没有任何一个行命令擦掉这个视图中绘制的东西吗?