如何讓以前的「標籤框」消失並被釋放? 我釋放對象,但當我點擊並移動時,它仍然只是在「標籤框」的頂部創建新的「標籤框」。如何讓以前的標籤消失並被釋放?
- (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];
}
JDL,您一直在圍繞一個星期,問的問題了一把。現在您已經學會了如何在問題中設置代碼的格式,所以我們不必爲您清理它。 http://stackoverflow.com/editing-help – 2011-05-25 04:43:05
我今天早上剛剛開始。但我會嘗試從您的鏈接學習如何格式化代碼。謝謝。 – jdl 2011-05-25 05:08:11