gpt4 book ai didi

iphone - setAnimationDidStopSelector @selector 没有运行方法

转载 作者:行者123 更新时间:2023-11-28 19:22:16 27 4
gpt4 key购买 nike

我之前在我的应用程序中使用过它,并且查看了所有我找不到区别的东西,但是由于某种原因,当我运行时:

-(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)sender;

谢谢。

最佳答案

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

的 Controller
[UIView setAnimationDelegate:self];

此外,根据文档,选择器应具有以下形式:

- (void)animationDidStop:(NSString *)animationID finished:(NSNumber *)finished context:(void *)context

最后,Apple 不鼓励在 iOS 4.0 或更高版本中使用此动画方法:

Use of this method is discouraged in iOS 4.0 and later. You should use the block-based animation methods to specify your animations instead.

关于iphone - setAnimationDidStopSelector @selector 没有运行方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7770029/

27 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com