【问题标题】:UIWebView resize slowUIWebView 调整大小缓慢
【发布时间】:2012-02-24 11:58:15
【问题描述】:

调整我的 UIWebView(s) 的速度很慢。当调整多个 UIWebViews(内容很大)的大小时,在 iPad2 上可能需要几秒钟。这是我使用的代码:

tmpUIWebView.frame = CGRectMake(0, 0, 768, 1004);

我知道调整大小可以很快完成,因为: - iPad 上的 Dolphin HD 浏览器可以非常快速地将多个选项卡调整为全屏。 - 此外,当我在调整大小时滚动 UIWebView 时,调整大小很快完成。

如何快速调整 UIWebViews 的大小(就像在 Dolphin HD 浏览器中一样)?有什么技巧吗?

感谢您的帮助!

格本

【问题讨论】:

  • 您能否提供有关通话背景的更多信息?似乎还有其他原因导致调整大小变慢。多一点代码或更直观的东西会有所帮助。
  • @notreallyJake 感谢您的帮助。我已经更改了代码。这就是我正在做的。在 UIWebView 中加载一个网页

标签: iphone ios ipad uiwebview


【解决方案1】:

这就是我慢慢隐藏视图的方式

- (void)hideLoadinNotification{

[UIView beginAnimations:@"fadeOut" context:NULL];
[UIView setAnimationDuration:0.25]; 
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(animationFinished:finished:context:)];
infoView.transform = CGAffineTransformMakeScale(1, 0.5);
[UIView commitAnimations];
}
- (void)showLoadinNotification{
[infoView setNeedsLayout];

[UIView beginAnimations:@"fadeIn" context:NULL];
[UIView setAnimationDuration:0.25]; 
[UIView setAnimationDelegate:self];
[UIView setAnimationDidStopSelector:@selector(animationFinished:finished:context:)];
infoView.transform = CGAffineTransformMakeScale(1, 1);
[UIView commitAnimations];
}
- (void)animationFinished:(NSString *)animationID finished:(BOOL)finished context:(void *)context{
if ([animationID isEqual:@"fadeOut"]) {
    [infoView removeFromSuperview];
}    
if ([animationID isEqual:@"fadeIn"]) {
    [self.tableView addSubview:infoView];
}    

}

【讨论】:

    【解决方案2】:

    您可以使用 transform 属性,但内容也会调整大小。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-10-03
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2013-07-27
      • 1970-01-01
      • 1970-01-01
      • 2016-03-17
      相关资源
      最近更新 更多