1

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;
            }
        }
    }

}

但结果还是一样

任何帮助将不胜感激

4

0 回答 0