2013-02-16 1 views
1

여러 PDF 문서를 표시하기 위해 iPhone APP에서 작업 중입니다.IBAction을 사용하여 UITableviewcell과 PDFreader를 어떻게 연결합니까?

.plist의 PDF 파일 이름을 표시하는 UItableview가 있으며 오픈 소스 VFR PDF 리더 (https://github.com/vfr/Reader)가 있습니다.

내가 VFR 리더에 액션과 함께있는 UIButton에서 하우투어요 Connet을 알고

- (IBAction)didClickOpenPDF1SEMCYTO { 
NSString *file = [[NSBundle mainBundle] pathForResource:@"1SEMCYTO" ofType:@"pdf"];  

ReaderDocument *document = [ReaderDocument withDocumentFilePath:file password:nil]; 

if (document != nil) 
{ 
    ReaderViewController *readerViewController = [[ReaderViewController alloc] initWithReaderDocument:document]; 
    readerViewController.delegate = self; 

    readerViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; 
    readerViewController.modalPresentationStyle = UIModalPresentationFullScreen; 

    [self presentModalViewController:readerViewController animated:YES]; 

- (void)dismissReaderViewController:(ReaderViewController *)viewController { 
[self dismissModalViewControllerAnimated:YES];} 

분명 내가 뭔가를해야하지만 난 알아 어차피 어떻게/무엇을 , 유일한 정말 비슷한 주제는 Custom UITableViewCell and IBAction 하지만 그 방법을 사용할 수 있는지 알아낼 수 없다면

어떤 아이디어가 도움이 될까요?

답변

0

테이블보기의 경우 행이 두드려 질 때마다 테이블보기 didSelectRowAtIndexPath의 대리자 메서드가 호출됩니다. (More about UITableViewDelegate)

ReaderPathController에 표시해야하는 PDF를 결정하기 위해 indexPath 매개 변수, 특히 아래 메서드에서 전달 된 행을 사용하십시오.

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath 
{ 
    // Navigation logic may go here. Create and push another view controller. 
    ReaderViewController *readerViewController = [[ReaderViewController alloc] initWithReaderDocument:document]; 
    readerViewController.delegate = self; 

    //determine the PDF to be shown based on indexPath.row 

    readerViewController.modalTransitionStyle = UIModalTransitionStyleCrossDissolve; 
    readerViewController.modalPresentationStyle = UIModalPresentationFullScreen; 

    [self presentModalViewController:readerViewController animated:YES]; 
} 

당신이 당신의 ReaderViewController의 대리자를 설정하는 방법처럼, 위의 방법을 구현 뷰 컨트롤러에 테이블 뷰 대리자를 설정해야합니다.

관련 문제