【发布时间】:2015-12-05 05:09:02
【问题描述】:
我有一个带有单元格的 tableView。在这个单元格中,我有一个 imageView 和一个覆盖它的按钮。该按钮有一个 IBAction。点击时,该按钮应该会召唤 imagePicker。 IBAction 代码位于单元格子视图中。
@IBAction func MyStatusImageButtonAction(sender: AnyObject) {
// Select Image
let imagePicker = UIImagePickerController()
imagePicker.delegate = self
imagePicker.sourceType = UIImagePickerControllerSourceType.PhotoLibrary
imagePicker.allowsEditing = false
self.presentViewController(imagePicker, animated: true, completion: nil)
因为这条线,我得到一个错误。
self.presentViewController(imagePicker, animated: true, completion: nil)
错误提示““myCell”类型的值没有成员“presentViewController”。
我是否应该在承载单元的 viewController 中加载 imagePicker,然后以某种方式将其传输到单元?我应该用不同的代码在单元格中加载 imagePicker 吗?我是不是搞错了?
为了清楚起见,我的目标是让用户加载这个 TableViewController,并且只能将图像分配给这个单元格中的 imageView。
谢谢。
【问题讨论】:
标签: ios swift uitableview uiimagepickercontroller