【发布时间】:2011-03-29 22:24:55
【问题描述】:
我担心的一件事是我创建了两个整数,但不释放它们。将它们设为 NSInteger 会更好吗?
-(void) flipCoin {
int heads = [headsLabel.text intValue];
int tails = [tailsLabel.text intValue];
if (random() %2 ==1 )
{
heads++;
}
else {
tails++;
}
headsLabel.text = [NSString stringWithFormat:@"%d", heads] ;
tailsLabel.text = [NSString stringWithFormat:@"%d", tails];
}
【问题讨论】:
标签: objective-c cocoa cocoa-touch memory-leaks