1

複数のPDFドキュメントを表示するためのiPhoneAPPに取り組んでいます。

.plistからのpdfファイルの名前を表示するUItableviewがあり、オープンソースのVFR pdfリーダー(https://github.com/vfr/Reader)があります。

UIボタンからvfrリーダーへのアクションを接続する方法を知っています:

- (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];}

明らかに私はそれのようなものが必要です、しかし私はどのように/何を理解することができません、唯一の本当に類似したトピックはこれ、カスタムUITableViewCellとIBActionでし た、しかし私はその中でメソッドを利用できるかどうか理解できません、

何かアイデアがありますか?

4

1 に答える 1

0

テーブル ビューの場合、行がタップされるたびに、テーブル ビュー didSelectRowAtIndexPath のデリゲート メソッドが呼び出されます。( UITableViewDelegate についての詳細)

indexPath パラメータ、特に以下のメソッドで渡される行を使用して、ReaderViewController に表示する必要がある PDF を決定します。

- (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 のデリゲートを設定する方法と同様に、上記のメソッドを実装するビュー コントローラーにテーブル ビュー デリゲートを設定することを忘れないでください。

于 2013-06-01T13:45:39.157 に答える