1
我一直试图在YouTube上的指南中创建一个共享按钮,然而我收到的错误对我来说没有意义 “无法转换类型的值(VideoViewController) - >(的UIButton) - >()预期参数 “字符串” 在这行代码:无法将类型为uibutton的值转换为预期的参数字符串
cell.shareButton.addTarget(self, action: Selector(VideoViewController.shareAction(_:)), forControlEvents: .TouchUpInside)
我的继承人按钮代码
@IBAction func shareAction(sender: UIButton)
{
let post = timelineComponent.content[sender.tag]
let titleString = post.labelTitle
let firstActivityItem = "\(titleString)"
let activityViewController : UIActivityViewController = UIActivityViewController(activityItems: [firstActivityItem], applicationActivities: nil)
self.presentViewController(activityViewController, animated: true, completion: nil)
}
更改为:'cell.shareButton.addTarget(self,action:#selector(shareAction(_ :)),forControlEvents:.TouchUpInside)' – Elena