这是在不同视图中刷新绘图的正确方法吗? [英] Is this the correct way of refreshing the drawing in a different view?

查看:98
本文介绍了这是在不同视图中刷新绘图的正确方法吗?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述


  • 在数据控制器头文件中导入CustomView.h

  • 从那里创建一个IBoutlet到我的CustomView

  • 将来自DataController的插座instoryboard连接到CustomView

  • 使用它来调用视图的setNeedsDisplay方法。

  • Import the CustomView.h in the data controller header file
  • Create an IBoutlet to my CustomView from there
  • Connect that outlet instoryboard from the DataController to the CustomView
  • Use that to call the view's setNeedsDisplay method.

每次我将一个项目添加到核心数据上下文时,我希望它通知CustomView(它位于另一个标签中)重绘自己。

Every time I add an item to the core data context I would like it to notify the CustomView (which lives in another tab) to redraw itself.

I我正在使用ios5和故事板。

I am using ios5 and storyboards.

推荐答案

是的,DataController应该在需要刷新时通知视图因为数据已经改变,所以你的实现是合理的。

Yep, the DataController should be notifying the view when it needs to refresh because the data has changed, so your implementation is sound.

这篇关于这是在不同视图中刷新绘图的正确方法吗?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆