Warning: file_get_contents(/data/phpspider/zhask/data//catemap/5/objective-c/22.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Iphone setAnimationDidStopSelector@selector未运行方法_Iphone_Objective C_Ios_Xcode - Fatal编程技术网

Iphone setAnimationDidStopSelector@selector未运行方法

Iphone setAnimationDidStopSelector@selector未运行方法,iphone,objective-c,ios,xcode,Iphone,Objective C,Ios,Xcode,我以前在我的应用程序中使用过这一点,在查看了所有内容后,我找不到区别,但出于某种原因,当我运行时: -(void)moveSelectorToDisplayPosition:(id)sender{ int givenTag = [sender tag]; UIImageView *tempImageView = [displayedSelections objectAtIndex:givenTag]; [UIView beginAnimations:@"" con

我以前在我的应用程序中使用过这一点,在查看了所有内容后,我找不到区别,但出于某种原因,当我运行时:

-(void)moveSelectorToDisplayPosition:(id)sender{

    int givenTag = [sender tag];
    UIImageView *tempImageView = [displayedSelections objectAtIndex:givenTag];



    [UIView beginAnimations:@"" context:NULL];
    [UIView setAnimationDuration:.3];
    tempImageView.frame = CGRectOffset(tempImageView.frame, 30 - tempImageView.frame.origin.x,  240 - tempImageView.frame.origin.y);
    [UIView setAnimationDidStopSelector:@selector(loadInTextForSelectedTool:)];
    [UIView commitAnimations]; 
}
loadInTextForSelectedTool
未被调用,我无法找出原因。没有错误或任何东西

这就是我正在尝试的方法,如果有人发现有什么不对劲或者我可能忘记了什么,有人能告诉我吗?我还尝试设置
[UIView setAnimationDelegate:tempImageView]但没有运气:(

-(void)loadInTextForSelectedTool:(id)发送方;


谢谢。

您需要将委托设置为实现
loadInTextForSelectedTool:

[UIView setAnimationDelegate:self];
此外,根据文档,选择器应具有以下形式:

- (void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context
最后,苹果不鼓励在iOS 4.0或更高版本中使用这种动画方法:

iOS 4.0及更高版本不鼓励使用此方法。您应该使用 使用基于块的动画方法来指定动画


您需要将委托设置为实现
loadInTextForSelectedTool:

[UIView setAnimationDelegate:self];
此外,根据文档,选择器应具有以下形式:

- (void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context
最后,苹果不鼓励在iOS 4.0或更高版本中使用这种动画方法:

iOS 4.0及更高版本不鼓励使用此方法。您应该使用 使用基于块的动画方法来指定动画


除非您需要在3.2或更早版本上运行,否则您应该使用块动画。它们确实简化了在动画结束时指定要执行的操作


除非您需要在3.2或更早版本上运行,否则您应该使用块动画。它们确实简化了在动画结束时指定要执行的操作


但动画运行良好,对吗?是的,所以我不确定问题出在哪里…但动画运行良好,对吗?是的,所以我不确定问题出在哪里…也许我对此有点困惑,但为什么我必须包含该方法?如果我只想在动画完成时调用自己的自定义方法?我还有一个n我的代码的精确工作副本,在其他地方,我不做这两个操作…知道为什么这样做吗?好吧,它可能是这样工作的,但是文档说明应该是选择器的形式:“动画结束后发送给动画代理的消息。默认值为NULL。选择器的形式应该是:-(void)animationDidStop:(NSString*)animationID finished:(NSNumber*)finished context:(void*)context。“,我现在正在查看动画块。感谢您的帮助。是的,这可能是最好的解决方案:)。也许我对此有点困惑,但为什么我必须包含该方法?如果我只想在动画完成时调用自己的自定义方法?此外,我有一个确切的工作副本,我的代码在其他地方,我不做这些。。。你知道为什么会这样吗?好吧,它可能是这样工作的,但是文档说明应该是选择器的形式:“动画结束后发送给动画代理的消息。默认值为NULL。选择器的形式应该是:-(void)animationDidStop:(NSString*)animationID finished:(NSNumber*)finished context:(void*)context。“,我现在正在研究动画块。感谢您的帮助。是的,这可能是最好的解决方案:)。