我有一个简单但令人沮丧的问题。
我的应用程序中有这一行:
[super setText:[[[NSString alloc] initWithFormat:@"%i" arguments:arg] autorelease]];
那条线来自第 3 方库,所以我试图摆脱警告并使其正常工作。无论如何,我将如何解决此警告?
谢谢!
完整方法:
- (void)timerLoop:(NSTimer *)aTimer {
//update current value
currentTextNumber += currentStep;
//check if the timer needs to be disabled
if ( (currentStep >= 0 && currentTextNumber >= textNumber) || (currentStep < 0 && currentTextNumber <= textNumber) ) {
currentTextNumber = textNumber;
[self.timer invalidate];
}
//update the label using the specified format
int value = (int)currentTextNumber;
int *arg = (int *)malloc(sizeof(int));
memcpy(arg, &value, sizeof(int));
//call the superclass to show the appropriate text
[super setText:[[[NSString alloc] initWithFormat:@"%i" arguments:arg] autorelease]];
free(arg);
}