【问题标题】:PDF in UIWebView not workingUIWebView 中的 PDF 不起作用
【发布时间】:2014-06-27 14:27:27
【问题描述】:

我有两个UIPopoverController。当我单击相应的按钮时,每个人都会在UIWebViewDelegate 中打开一个pdf。 但是,只有一个有效。 两个按钮 A 和 B 都具有这种单击功能的格式(除了 Button B 会说 ButtonB 而不是 ButtonA)

- (IBAction)openPDF_Pictures_A:(id)sender
{


    ButtonAPDFViewController *DWV =[[ButtonAPDFViewController alloc] initWithNibName:nil bundle:nil];

    self.masterPopOverController = [[UIPopoverController alloc] initWithContentViewController:DWV];

    [self.masterPopOverController presentPopoverFromRect:[sender frame] inView:[sender superview] permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
    [self.masterPopOverController setPopoverContentSize:CGSizeMake(600, 800) animated:NO];




}

在每个 UIWebView 的 UIViewController 中,是这样的:

#import "ButtonAViewController.h"

@interface ButtonAViewController ()

@end

@implementation ButtonAViewController

@synthesize buttonAPDFView;

- (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:@"partA" ofType:@"pdf"];
    NSURL *targetURL = [NSURL fileURLWithPath:path];
    NSURLRequest *request = [NSURLRequest requestWithURL:targetURL];
    [buttonAPDFView loadRequest:request];



}
- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

@end

按钮 A 和 B 位于同一视图中。我确实让其中一个 IBActions 使用 masterPopOverController2 和一个 masterPopOverController 来查看是否可以解决任何问题,但它没有。不起作用的会打开一个弹出窗口,但它不会在弹出窗口中显示 PDF。有什么建议吗?

【问题讨论】:

    标签: ios objective-c uiwebview uipopovercontroller uiwebviewdelegate


    【解决方案1】:

    刚刚意识到我没有在xib的UIView里面添加UIWebView...

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-12-23
      • 1970-01-01
      • 1970-01-01
      • 2011-01-31
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2011-12-12
      相关资源
      最近更新 更多