【问题标题】:Why does this not change the size of the webview [duplicate]为什么这不会改变 webview 的大小 [重复]
【发布时间】:2013-04-18 10:08:23
【问题描述】:

这个已解决的stackoverflow答案对我不起作用,我不知道为什么。

Height of UIWebView minus 44px programmatically?

 CGRect oldFrame = WebView.frame;
    CGRect newFrame =CGRectMake(oldFrame.origin.x, oldFrame.origin.y, oldFrame.size.width, oldFrame.size.height-44);
    [WebView setFrame:newFrame];

【问题讨论】:

  • 真的这么叫吗?是self.webView != nil
  • 检查 [this][1] 请检查链接 希望这有帮助 [1]:stackoverflow.com/questions/14868668/…
  • @DrummerB 如果我打电话 if (self.webView != nil) NSLog(@"Yes");那么这一行就叫做
  • @ChiragPipaliya 我试过了,但它也不想工作。

标签: ios objective-c webview


【解决方案1】:

在重新加载你的 webview 之后尝试这样一次,

    self.webView.frame = CGRectMake(self.webView.frame.origin.x, self.webView.frame.origin.y, self.webView.frame.size.width, 0);
  [self.webView reload];

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2021-09-07
    • 1970-01-01
    • 2021-12-20
    • 2015-08-31
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多