2014-01-07 3 views
1

iOS6의 UITextView에 오디오 태그를 추가하는 방법이 있습니까?UITextView의 iOS6 오디오 태그

오디오 태그 란 무엇입니까?

오디오 태그는 오디오 파일을 가리키는 하이퍼 링크입니다. 오디오 태그를 클릭하면 파일이 열리고 재생됩니다.

- (BOOL)textView:(UITextView *)textView shouldInteractWithURL:(NSURL *)URL inRange:(NSRange)characterRange{ 
    // Now deal with the url to play audio file 

    self.theAudio=[[AVAudioPlayer alloc] initWithContentsOfURL:(__bridge NSURL *)(URL) error:NULL]; 
    self.theAudio.volume = 1.0; 
    self.theAudio.delegate = self; 
    [self.theAudio prepareToPlay]; 

    [self.theAudio play]; 
    } 

는 희망이 도움이 :

+0

** 오디오 태그 ** 하이퍼 링크 (문자열 형식)가 맞습니까? –

+0

@KumarKl 예 오디오 태그는 하이퍼 링크이지만 텍스트 뷰에서는 언급 된 전체 경로가 필요하지 않습니다. 예를 들어 문자열 "a"는 오디오 태그에 링크 될 수 있습니다. – devmobile247

답변

1

나는 UITextView delegate 방법을 사용하여 얻을 수있는 방법이 있기를 바랍니다.

+0

이 링크를 확인하십시오. ** http : //stackoverflow.com/questions/2543967/how-to-intercept-click-on-link-in-uitextview** –