【发布时间】:2014-02-06 16:54:58
【问题描述】:
我有 2 个视图控制器
ViewControllerWithCollectionView (FIRST) 和 ModalViewControllerToEditCellContent (SECOND)
我以模态方式从 FIRST 转到 SECOND。编辑单元格。返回。
关闭 SECOND 控制器后,编辑的单元格在我调用之前不会更新 [收集重载数据];手动某处。
试图把它放在 viewWillAppear:animated: 中,当我检查日志时,它没有被调用(在关闭 SECOND 之后)
我尝试了各种解决方案,但我无法通过(也许我太累了)。我感觉我缺少一些基本的东西。
编辑关闭按钮
- (IBAction)modalViewControllerDismiss
{
self.sticker.text = self.text.text; //using textFields text
self.sticker.title = self.titleText.text;// title
//tried this also
CBSStickerViewController *pvc = (CBSStickerViewController *)self.stickerViewController;
//tried passing reference of **FIRST** controller
[pvc.cv reloadData];//called reloadData
//nothing
[self dismissViewControllerAnimated:YES completion:^{}];
}
【问题讨论】:
-
viewWillAppear 应在其呈现的 vc 被解除时在呈现的 vc 上触发。请发布关闭第二个视图控制器的代码并说明该代码所在的位置。
-
- (IBAction)modalViewControllerDismiss { self.sticker.text = self.text.text; //using textFields text self.sticker.title = self.titleText.text;// title //tried this also CBSStickerViewController *pvc = (CBSStickerViewController *)self.stickerViewController; //tried passing reference to **FIRST** controller [pvc.cv reloadData];//called reloadData [self dismissViewControllerAnimated:YES completion:^{}]; } -
我之前的评论有误。 viewWillAppear 在呈现视图控制器被关闭时不会被调用。
标签: ios uicollectionview segue modalviewcontroller