2016-09-13 2 views
1

YouTube에서 가이드에 따라 내 tableview 셀에 공유 버튼을 만들려고했지만 그다지 의미가없는 오류가 발생했습니다 "형식 값을 변환 할 수 없습니다. (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) 

} 
+0

변경 : 'cell.shareButton.addTarget (self, action : #selector (shareAction (_ :)), forControlEvents : .TouchUpInside)' – Elena

답변

2

이 같은 시도 Heres는 내 버튼 코드가 ​​작동합니다

cell.shareButton.addTarget(self, action: #selector(VideoViewController.shareAction(_:)) , forControlEvents: .TouchUpInside) 
관련 문제