2016-09-17 12 views
0

셀에서 데이터 (데이터 복사)를 캡처 한 다음 사용자가 imgtagAction을 가볍게 두드리면 다른 함수를 호출하는 버튼에 다음 함수 (이 코드는 library)를 사용합니다. 첫 번째 버튼 func buttonViewLinkAction이 효과적입니다. 나는 AlertView를 얻었고 다른 버튼은 imgtagAction과 함께 표시됩니다. 그러나 해당 버튼을 클릭하면 다음과 같이 표시됩니다.함수 내에서 함수 호출?

인식 할 수없는 선택기를 인스턴스로 보냄. 나는 buttonViewLinkAction 기능의 외부 imgtagAction 기능을 이동할 때

//get buttonViewLinkAction and copy to pasteboard 
@IBAction func buttonViewLinkAction(sender: UIButton) { 
    print("buttonViewLinkAction tapped") 
    let face = self.faces[sender.tag] 
    if let imageNAME: String = String(face.name){ 
     print(imageNAME .uppercaseString) 
    } 
    if let imageURL = NSURL(string:face.image) { 
     print(imageURL) 
    } 

    UIPasteboard.generalPasteboard().string = face.directLink 

    let alertView = SCLAlertView() 
    alertView.addButton("Add [imag] tags", target:self, selector:Selector("imgtagAction:")) 
    alertView.showSuccess((face.name), subTitle: "Direct link copied to clipboard") 

    func imgtagAction(Sender: AnyObject) { 
     print("imgtagAction tapped") 
     UIPasteboard.generalPasteboard().string = "[img]" + face.directLink + "[/img]" 
    } 

} 

그래서, 셀 데이터에 액세스 할 수 없습니다.

func imgtagAction(Sender: AnyObject) { 
    print("imgtagAction tapped") 
    let face = self.faces[sender.tag] 
    if let imageNAME: String = String(face.name){ 
     print(imageNAME .uppercaseString) 
    } 
    if let imageURL = NSURL(string:face.image) { 
     print(imageURL) 
    } 
    UIPasteboard.generalPasteboard().string = "[img]" + face.directLink + "[/img]" 
} 

내가 오류는 다음과 같습니다 해결되지 않은 식별자 '보낸 사람'의

사용.

내가 뭘 잘못하고 있니?

+1

스위프트는 대소 문자를 구별합니다. – rmaddy

+0

죄송합니다. 내가 겪고있는 문제에 어떻게 적용되는지 모르겠습니다. – user3591436

+2

'sender' 대'Sender'. – rmaddy

답변

0

sender 대신 Sender이 있습니다. 이것은 당신의 기능이 어떻게 보일 것인가입니다.

func imgtagAction(sender: AnyObject) 
{ 
    print("imgtagAction tapped") 
    let face = self.faces[sender.tag] 
    if let imageNAME: String = String(face.name) 
    { 
     print(imageNAME .uppercaseString) 
    } 
    if let imageURL = NSURL(string:face.image) 
    { 
     print(imageURL) 
    } 
    UIPasteboard.generalPasteboard().string = "[img]" + face.directLink + "[/img]" 
} 
관련 문제