使用“GetTiming()”的错误和警告CAKeyframeAnimation 的函数

发布于 2024-12-20 23:33:30 字数 666 浏览 2 评论 0原文

我遇到了有关“GetTiming()”函数使用的一个错误和一个警告。我的冷如下:

[values addObject:[NSNumber numberWithFloat:25.0]];
[timings addObject:GetTiming(kCAMediaTimingFunctionEaseIn)];
[keytimes addObject:[NSNumber numberWithFloat:0.0]];

我正在导入以下内容:

#import <QuartzCore/CAAnimation.h>
#import <QuartzCore/CAMediaTimingFunction.h>

我认为错误是由于我正在使用 ARC,并说:

implicit conversion of 'int' to 'id' is disallowed with ARC.

我尝试在相关文件中禁用 ARC,但错误仍然存​​在。

关于警告,它说:

implicit declaration of function 'GetTiming' is invalid in C99

任何人对如何解决这些问题有任何想法吗? 多谢!

I'm having one error and one warning concerning the usage of the 'GetTiming()' function. My colde is as follows:

[values addObject:[NSNumber numberWithFloat:25.0]];
[timings addObject:GetTiming(kCAMediaTimingFunctionEaseIn)];
[keytimes addObject:[NSNumber numberWithFloat:0.0]];

I am importing the following:

#import <QuartzCore/CAAnimation.h>
#import <QuartzCore/CAMediaTimingFunction.h>

The error I suppose is due to the fact that I'm using ARC, and says:

implicit conversion of 'int' to 'id' is disallowed with ARC.

I tried to disable ARC in the concerning file but the error persists.

About the warning, it says:

implicit declaration of function 'GetTiming' is invalid in C99

Any one have any ideas on how can I fix these issues?
Thanks a lot!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

恍梦境° 2024-12-27 23:33:30

首先确保 GetTiming 函数存在(包括正确的标头)。现在,如果 GetTiming 返回一个 int 问题是您无法将原始值添加到数组中。您需要将返回的值包装在 NSNumber 中。

[timings addObject:
    [NSNumber numberWithInt:GetTiming(kCAMediaTimingFunctionEaseIn)]];

编辑:

您缺少 JackController.m 中声明的函数。

CAMediaTimingFunction* GetTiming(NSString* name) {
    return [CAMediaTimingFunction functionWithName:name];
}

为了简单起见,不要使用该函数,只需直接创建它。

[timings addObject:
    [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]];

First make sure that the GetTiming function exists (include the right header). Now if GetTiming returns an int the problem is you can not add a primitive value to an array. You need to wrap the value returned in an NSNumber.

[timings addObject:
    [NSNumber numberWithInt:GetTiming(kCAMediaTimingFunctionEaseIn)]];

Edit:

You are missing the function that was declared in JackController.m.

CAMediaTimingFunction* GetTiming(NSString* name) {
    return [CAMediaTimingFunction functionWithName:name];
}

For simplicity do not use that function, just create it directly.

[timings addObject:
    [CAMediaTimingFunction functionWithName:kCAMediaTimingFunctionEaseIn]];
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文