【问题标题】:linking viewController functions through container view to table view controller通过容器视图将 viewController 功能链接到表视图控制器
【发布时间】:2015-03-06 22:05:42
【问题描述】:

编辑:这是一个新问题,但我必须编辑一个旧问题才能发布它,因为我有发布限制。

我正在尝试将这 4 个函数链接到嵌入在容器视图中的表视图控制器。我该怎么做呢?

我使用嵌入式容器的原因是我在使用静态表视图控制器时遇到了错误,我需要一个静态表视图控制器,这样我就可以将“labelSlider”和“labelSliderChanged”链接到同一个视图我在表视图控制器中。

这是 viewController.h 和故事板文件的图片:http://postimg.org/image/o8moyzmar/

【问题讨论】:

  • 这是一个太小且不完整的sn-p:pts是什么?如果tempPoint 是一个指针(不清楚),为什么pts[ptsIndex] = &tempPoint?您确定启用并处理 all 编译器警告吗?但是.. 如果您使用 ..point.. 来表示您的应用程序而不是编码,那么它的命名很差。
  • 我发布了一个编辑,希望可以解决问题。

标签: c++ ios objective-c opencv uistoryboard


【解决方案1】:

在堆栈上创建的变量一旦不在范围内,它们的内存就会被扔回“空闲内存”池中。

  CvPoint tempPoint; // this creates the CvPoint on the stack
  ...
  pts[ptsIndex] = &tempPoint; // here, you have assigned a local address
} // tempPoint's memory is released back to the system.
  // the pointer to this memory will now be pointing at garbage

相反,你为什么不直接创建pts

CvPoint pts[POINT_TOTAL];

然后将你的值直接赋值给它:

pts[ptsIndex] = tempPoint;

【讨论】:

  • pts 作为参数传入并且是一个指针,所以 pts[ptsIndex] = tempPoint 给出“assigning CvPoint* from CvPoint”的错误
  • 你没有做我说的第一件事。
  • 请看我的编辑。感谢您的帮助,但我继续遇到错误。我现在在调用 DetectAndDraw 函数时遇到断点错误。
猜你喜欢
  • 2015-10-23
  • 2015-08-03
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2012-09-22
  • 2011-09-09
  • 2013-06-11
  • 1970-01-01
相关资源
最近更新 更多