Ios UIImagePickerController(didFinishPickingMediaWithInfo)未在UITableViewCell中调用

Ios UIImagePickerController(didFinishPickingMediaWithInfo)未在UITableViewCell中调用,ios,uitableview,swift,uiimagepickercontroller,ios8.2,Ios,Uitableview,Swift,Uiimagepickercontroller,Ios8.2,我有一个UITableViewCell按钮,可以拍摄图像并将其放回单元格中。当我调用UIImagePickerController并拾取/拍摄图像时,它应该调用以下函数 func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [NSObject : AnyObject], sender:AnyObject) 由于某些原因,它不调用此函数,因此,我无法将所选

我有一个UITableViewCell按钮,可以拍摄图像并将其放回单元格中。当我调用UIImagePickerController并拾取/拍摄图像时,它应该调用以下函数

 func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [NSObject : AnyObject], sender:AnyObject) 
由于某些原因,它不调用此函数,因此,我无法将所选UIImage放置到当前单元格中。任何帮助都是非常感激的

这是按钮代码

@IBAction func takePhoto(sender: AnyObject) {
    let imagePickerController = UIImagePickerController()
    imagePickerController.delegate = self
    imagePickerController.allowsEditing = true

    let actionSheet = UIAlertController(title: "Choose image souruce", message: nil, preferredStyle: UIAlertControllerStyle.ActionSheet)

    actionSheet.addAction(UIAlertAction(title: "Take Image", style: UIAlertActionStyle.Default, handler: { (alert:UIAlertAction!) -> Void in
        imagePickerController.sourceType = UIImagePickerControllerSourceType.Camera
        self.presentViewController(imagePickerController, animated: true, completion: nil)
    }))

    actionSheet.addAction(UIAlertAction(title: "Photo Library", style: UIAlertActionStyle.Default, handler: { (alert:UIAlertAction!) -> Void in
        imagePickerController.sourceType = UIImagePickerControllerSourceType.PhotoLibrary
        self.presentViewController(imagePickerController, animated: true, completion: nil)
    }))
    actionSheet.addAction(UIAlertAction(title: "Cancel", style: UIAlertActionStyle.Cancel, handler: nil))
    self.presentViewController(actionSheet, animated: true, completion: nil)

}
这是didFinishPickingMediaWithInfo上的imagePickerController函数

self.reloadData是运行UITableView并重新加载数据的函数

func imagePickerController(picker: UIImagePickerController, didFinishPickingMediaWithInfo info: [NSObject : AnyObject], sender:AnyObject) {
    var btnPos: CGPoint = sender.convertPoint(CGPointZero, toView: self.tableView)
    //Gets the chosen cell indexPath
    var indexPath: NSIndexPath = self.tableView.indexPathForRowAtPoint(btnPos)!
    let currentCell:TableViewCell = tableView.cellForRowAtIndexPath(indexPath) as TableViewCell
    let iamgePicked:UIImage = info[UIImagePickerControllerOriginalImage] as UIImage
    currentCell.cellImageOulet.image = iamgePicked
    picker.dismissViewControllerAnimated(true, completion: nil)
    self.loadData()


}
这是行不通的。表视图具有某种声明式的数据源样式。 这意味着您需要保存要在表视图中显示的图像,并在tableViewCellForRowAtIndexPath中使用它们

let currentCell:TableViewCell = tableView.cellForRowAtIndexPath(indexPath) as TableViewCell