gpt4 book ai didi

c++ - UIView animateWithDuration :animations:completion: blocks don't comile in an . 毫米文件

转载 作者:塔克拉玛干 更新时间:2023-11-02 20:20:38 24 4
gpt4 key购买 nike

我在 .mm 文件中有以下代码:

[UIView animateWithDuration:0.3 animations:^{
self.titleLabel.alpha = 0.0;
} completion:^(BOOL finished) { //<<compiler complains here
self.titleLabel.alpha = 1.0;
}];

但是我得到了编译器错误:

Cannot initialize a parameter of type 'void (^)(BOOL)' with an rvalue of type 'void (^)(int)'

在上面提到的那一行。该代码在普通 .m 文件中没有问题。是我做错了什么,还是编译器有问题?

更新: header 导入是:

#import <UIKit/UIKit.h>

和 .mm 导入(审查):

#import "XXSelectViewController.h"
#import "XXViewController.h"
#import "AboutViewController.h"
#import "HighScoresViewController.h"
#import "GameModel.h"

更新 2:此外,我在这一行收到警告:

- (void)viewDidDisappear:(BOOL)animated

警告:

Conflicting parameter types in implementation of 'viewDidDisappear:': 'BOOL' (aka 'signed char') vs 'int'

我们在这个项目中使用了 PowerVR 工具,在 PVRShell.h 和 PVRTResourceFile.h 中有以下几行:

typedef bool (*PFNReleaseFileFunc)(void* handle);

typedef bool (*PFNReleaseFileFunc)(void* handle);

虽然我不知道这是否与这些问题有关...

最佳答案

原来错误的原因是因为这条线,深埋在 PVR 工具中:

#define BOOL int

所以有一个宏遍历所有代码,将 BOOL 替换为 int。不理想!我认为它导致问题的原因是因为这些工具是作为文件夹添加的,而不是作为嵌入式 .xcodeproj ...所以我们可能需要重新导入它。吸取教训!

但奇怪的是,如果我注释掉该行,代码仍然有效 ;) 但谁知道会持续多久!

关于c++ - UIView animateWithDuration :animations:completion: blocks don't comile in an . 毫米文件,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11879656/

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