cancelPreviousPerformRequestsWithTarget对我不起作用,我检查过每个人说它工作正常但对我来说不是
我在performselector中调用以下内容
[self performSelector:@selector(Opacity:) withObject:self.objopcarray afterDelay:reversedelay];
现在我想在按钮点击之前将其取消,然后点击它,所以我做了以下
- (void) pressNextButton:(id)sender
{
[NSObject cancelPreviousPerformRequestsWithTarget:self selector:@selector(Opacity:) object:self.objopcarray];
if (self.animationON == YES)
{
if (self.panel < 16)
{
[self DisplayImages];
[timer invalidate];
timer = [NSTimer scheduledTimerWithTimeInterval:sketchanimduration target:self selector:@selector(DisplayImages) userInfo:nil repeats:YES];
if(self.panel > 16)
{
self.panel = 0;
}
}
}
}
但结果仍然相同
任何帮助都将受到高度赞赏