我有两个ViewController。第一个ViewController有一个TableView。我以编程方式呈现第二个ViewController。在第二个ViewController中,我下载了一个图像。现在我在完成下载后关闭第二个ViewController。同时我想用图像更新TableView并选择特定的单元格。
我使用委托来完成这个过程。但它无法更新TableView。
我使用viewDidAppear,viewWillAppear方法重新加载TableView。但没有效果。
有人建议我完成这项具体任务吗?
我通过这种方式展示了我的第二个ViewController:
ImageSelectionViewController *viewController= [[UIStoryboard storyboardWithName:@"Main" bundle:nil] instantiateViewControllerWithIdentifier:@"modal"];
viewController.modalPresentationStyle = UIModalPresentationCustom;
viewController.carDownloadName = [self.listOfItem objectAtIndex:sender.tag];
[self presentViewController:viewController animated:YES completion:nil];
并通过这种方式解除ViewController:
[self dismissViewControllerAnimated:YES completion:nil];
答案 0 :(得分:0)
你可以使用dismiss block
[self dismissViewControllerAnimated:YES completion:^ {
=IF([Month (Calculated)]="1", "January","No date")
=IF([Month (Calculated)]="2", "February","No date")
=IF([Month (Calculated)]="3", "March","No date")
=IF([Month (Calculated)]="4", "April","No date")
=IF([Month (Calculated)]="5", "May","No date")
=IF([Month (Calculated)]="6", "June","No date")
=IF([Month (Calculated)]="7", "July","No date")
=IF([Month (Calculated)]="8", "August","No date")
=IF([Month (Calculated)]="9", "September","No date")
=IF([Month (Calculated)]="10", "October","No date")
=IF([Month (Calculated)]="11", "November","No date")
=IF([Month (Calculated)]="12", "December","No date")
答案 1 :(得分:0)
要发送UIImage,请在ViewControllerA中执行以下操作:
override func prepareForSegue(segue: UIStoryboardSegue, sender: AnyObject?) {
let viewControllerB = segue.destinationViewController as! ViewControllerB
viewControllerB.callback = { message in
//Do what you want in here!
}
}
在ViewControllerB中:
var callback : (String -> Void)?
@IBAction func done(sender: AnyObject) {
callback?("Hi")
self.dismissViewControllerAnimated(true, completion: nil)
}