这是带NSFetchedResults控制器或不带NSFetchedResults控制器的好问题 - 您有一个观察模型的表vc,并且您希望用户在弹出或从其他视图控制器关闭后看到动画更改。
可能有更好的办法,但最近我在类似的情况下做的事情是让vc根据来自子公司(推送或模态呈现)vc的委托消息自行完成模型更新。
所以,在表VC:
AddingVC *addingVC = [[AddingVC alloc] initWithDelegate:self];
[self presentModalViewController:addingVC animated:YES];
// adding to the model will happen in this vc, based on a delegate message
- (void)addingVcDidCreateAnObjectToAdd:(id)objectToAdd {
// add to your model here
}
的添加VC做到这一点(和我不能完全以此为傲,但它的作品)......
- (void)thingIsReadyToAdd {
SEL selector = @selector(addingVcDidCreateAnObjectToAdd:);
[self.delegate performSelector:selector withObject:objectToAdd afterDelay:1.5];
// 1.5 is on the long side, since the vc transition is about 0.5, so 1.0 is okay
}
在我案例中,我使用了一个更传统的委托协议,传递添加VC作为第一个参数,但这样做延迟需要一个详细的NSInvocation,所以我在这里跳过它。对于那个让我困扰的问题+1。我很好奇别人的解决方案。