ios - -[UIView setHostedGraph :] unrecognized selector sent to instance

标签 ios objective-c xcode uiview core-plot

我正在尝试使用 Core Plot 绘制图表,但我的图 TableView 被实例化为 UIView 即使我已将其设置为 CPTGraphHostingView 在界面生成器中:

enter image description here

这是我的代码:

usersGraph = [[CPTXYGraph alloc] initWithFrame:usersGraphView.frame];
usersGraphView.hostedGraph = usersGraph;

为什么会这样?

最佳答案

在 Interface Builder 中断断续续地反复尝试一切之后,我开始在 StackOverflow 上搜索更多内容,并且偶然发现了这个问题:Application crashes when working with core plot

很奇怪,但这不是 IB 问题(我确信我在 IB 中做的是正确的,我以前做过一千次),而是链接器问题。我不知道为什么,但我必须将 -ObjC 添加到链接器标志,它起作用了。

关于ios - -[UIView setHostedGraph :] unrecognized selector sent to instance,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/23488933/

相关文章:

ios - UIButton addTarget 是如何工作的?

ios - 是否所有 UIVIewController 都带有 UINavigationController、UISearchDisplayController 等?

ios - 为核心数据迁移测试生成旧版本xcdatamodel的数据

ios - 代码签名错误。添加新的mac进行开发

ios - 试图从备份恢复 xcode 5 项目,现在出现 fatal error

iphone - XCode中的组和文件与Finder中的项目文件夹

iphone - 如何在 UINavigationController 的 RootViewController 上显示后退按钮?

ios - Xcode - 如何修复 'NSUnknownKeyException',原因 : … this class is not key value coding-compliant for the key X"error?

ios - 从 LinkedIn API 获取电子邮件地址

Xcode 询问我 "who you are"(截图)