2016-09-13 12 views
1

YouTubeのガイドに従って、私のtableviewセル内に共有ボタンを作成しようとしましたが、私には意味をなさないエラーが発生しました "型の値を変換できません(VideoViewController) - >(UIButton) - >()のコード行で予想引数 "文字列" へ:uibutton型の値を期待される引数文字列に変換できません

cell.shareButton.addTarget(self, action: Selector(VideoViewController.shareAction(_:)), forControlEvents: .TouchUpInside) 

HERESに私のボタンのコード

@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) 

} 
+0

これに変更してください: 'cell.shareButton.addTarget(self、action:#selector(shareAction(_ :))、forControlEvents:.TouchUpInside)' – Elena

答えて

2

このようにしてみてください、それが動作するはずです

cell.shareButton.addTarget(self, action: #selector(VideoViewController.shareAction(_:)) , forControlEvents: .TouchUpInside) 
関連する問題