0

我正在做一个 iPhone 应用程序,它在单击它们各自的表格单元格时加载 14 个不同的 PDF 文件。已经创建了两个 ViewController,并且一个 UIWebview 用于加载 PDF 文件。我的问题是,单击每个表格单元格时都会将我带到同一个 PDF 文件。是否可以提供我可以参考的任何参考资料或源代码?请帮忙!


#import "IssueDetailViewController.h"
#import "ItemsViewController.h"
#import "Issues.h"
#import "IssueCell.h"

@interface IssueDetailViewController ()

@end

@implementation IssueDetailViewController
@synthesize issueItem;


- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// Custom initialization
}
return self;
}

-(void)viewDidLoad
{
[super viewDidLoad];
NSString *path = [[NSBundle mainBundle] pathForResource:@"network_38" ofType:@"pdf"];
NSURL *url = [NSURL fileURLWithPath:path];
NSURLRequest *request = [NSURLRequest requestWithURL:url];
[webview loadRequest:request];
webview.autoresizingMask=(UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight); 
[webview setScalesPageToFit:YES];

}



- (void)viewDidUnload
{
IssueView = nil;
[super viewDidUnload];
// Release any retained subviews of the main view.
// e.g. self.myOutlet = nil;
}

- (BOOL)shouldAutorotateToInterfaceOrientation:       (UIInterfaceOrientation)interfaceOrientation

{
return (interfaceOrientation == UIInterfaceOrientationPortrait);
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
IssueDetailViewController *detailViewController = [[IssueDetailViewController alloc] init];



[[self navigationController] pushViewController:detailViewController animated:YES];
}

-(void) viewWIllAppear:(BOOL)animated
{
[super viewWillAppear:animated];

}


-(void) setIssueItem:(Issues *)i
{
issueItem = i;
[[self navigationItem] setTitle:[issueItem issueName]];
}




@end
4

1 回答 1

0

因为您只设置了一个 PDF 以在 Web 视图中打开。

解决方案 - 获取 selectedRow 并发送整数(0-14)并在您的网络视图中捕获它并根据所选行加载您的 pdf。

于 2012-07-24T11:29:37.167 回答