Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
Sprite *shipViewTemp = [[UIImageView alloc] initWithImage:(UIImage *) ship];
这是我的代码中唯一的错误,有人可以帮忙吗?
不兼容的指针类型
查看 Xcode 给你的完整错误。通常,错误/警告会告诉您究竟出了什么问题。在这种情况下,完整的错误很可能是:
Incompatible pointer types initializing 'Sprite' with an expression of type 'UIImageView *'
在这种情况下,它告诉您您正在尝试将 的实例分配给UIImageView期望Sprite. (在下面的屏幕截图中,我使用NSString了 ,但您会看到与 类似的内容Sprite。)
UIImageView
Sprite
NSString