我正在编写一个相当简单的应用程序,它生成一个线程,该线程最终调用以下方法将 UILabel 放在某个位置。我曾期望 ARC 在方法关闭时清理标签。我错了。:)
有没有办法强制清理这些东西,或者有什么明显的我遗漏的东西?谢谢!
-(void) drawNumberLabel:(NSString *)labelText xloc:(float)xLocation yLoc:(float)yLocation {
UILabel *tempLabel;
tempLabel = [[UILabel alloc] initWithFrame:CGRectMake(xLocation, yLocation, 27.0, 59.0)];
tempLabel.font = [UIFont fontWithName:@"Helvetica" size:fontSize];
tempLabel.text = labelText;
tempLabel.backgroundColor = backgroundColor;
tempLabel.textColor = textColor;
[self addSubview:tempLabel];
}