gpt4 book ai didi

swift - CGRectIntersectsRect 调用错误中缺少参数 #2

转载 作者:行者123 更新时间:2023-11-30 13:06:54 24 4
gpt4 key购买 nike

我正在用 swift 编写一个小游戏,其中一艘船必须绕过障碍物。但是,我在 CGRectInersectsRect 中不断收到“调用中参数 #2 缺少参数”错误。我已经检查了如何在目录中调用它,并且调用正确。我的代码有什么问题?这是:

 if (CGRectIntersectsRect(boat: CGRect, obstacleImageView: CGRect)) {
endGame()
}
}

最佳答案

if (CGRectIntersectsRect(boat.frame,barrierImageView.frame)) {
结束游戏()
}
}

CGRect 是参数的一种类型。调用函数时不应使用它。

关于swift - CGRectIntersectsRect 调用错误中缺少参数 #2,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39248920/

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