简体   繁体   English

这是在其他视图中刷新图形的正确方法吗?

[英]Is this the correct way of refreshing the drawing in a different view?

  • Import the CustomView.h in the data controller header file 将CustomView.h导入数据控制器头文件中
  • Create an IBoutlet to my CustomView from there 从那里创建一个到我的CustomView的IBoutlet
  • Connect that outlet instoryboard from the DataController to the CustomView 将该插座Instoryboard从DataController连接到CustomView
  • Use that to call the view's setNeedsDisplay method. 使用它来调用视图的setNeedsDisplay方法。

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. 每次将项目添加到核心数据上下文时,我都希望它通知CustomView(位于另一个选项卡中)重新绘制自己。

I am using ios5 and storyboards. 我正在使用ios5和情节提要。

是的,DataController应该在需要刷新时通知视图,因为数据已更改,因此您的实现是合理的。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM