如何让之前的“标签框”消失并被释放?我释放了该对象,但当我点击并移动时,它仍然只是在“标签框”之上创建新的“标签框”。
- (void)touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event {
[super touchesMoved:touches withEvent:event];
CGPoint nowPoint = [[touches anyObject] locationInView:self.view];
CGPoint prevPoint = [[touches anyObject] previousLocationInView:self.view];
CGRect RectFrame1;
RectFrame1 = CGRectMake(nowPoint.x, nowPoint.y, 280, 30);
UILabel *label = [[UILabel alloc] initWithFrame:RectFrame1];
label.text = [NSString stringWithFormat:@"x %f y %f", nowPoint.x, nowPoint.y];
label.backgroundColor = [UIColor blackColor];
label.textColor = [UIColor whiteColor];
[self.view addSubview:label];
[label release];
//[self release];
//[&RectFrame1 release];
}