【问题标题】:display full screen pdf in uiwebview在uiwebview中显示全屏pdf
【发布时间】:2011-03-24 10:45:48
【问题描述】:

我正在尝试在 uiwebview 中加载 pdf,但 pdf 在书写手侧显示为空白

如何让全屏显示

UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(0,0,self.view.bounds.size.width,self.view.bounds.size.height)];

    //webView.contentMode = UIViewContentModeScaleAspectFit;

    NSString *path = [[NSBundle mainBundle] pathForResource:@" manual" ofType:@"pdf"];
    NSURL *targetURL = [NSURL fileURLWithPath:path];
    NSURLRequest *request = [NSURLRequest requestWithURL:targetURL];


    CGRect frame = webView.frame;
    // you may need to modify the 5 and 10 below to match the size of the PDF border
    frame.origin.x = frame.origin.x - 5;
    frame.origin.y = frame.origin.y - 5;
    frame.size.width = frame.size.width + 100;
    frame.size.height = frame.size.height + 100;


    webView.frame = frame; 

     [webView loadRequest:request];

    [self.view addSubview:webView];
    [webView release];

【问题讨论】:

  • 你能放一张你得到的截图吗

标签: iphone objective-c xcode ipad uiwebview


【解决方案1】:

在 webview 上设置属性 scalesPagesToFit,你应该没问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-29
    • 1970-01-01
    • 1970-01-01
    • 2013-07-29
    • 2016-08-10
    • 1970-01-01
    相关资源
    最近更新 更多