【问题标题】:UIWebView and UIPageViewControllerUIWebView 和 UIPageViewController
【发布时间】:2012-10-07 15:38:57
【问题描述】:

我有使用 UIWebView 显示的 html 内容。用户使用 UIPageViewController 导航页面。问题是页面显示后,web view 完成了内容的渲染。有明显的延迟使性能迟缓。

- (ContentViewController *)viewControllerAtIndex:(NSUInteger)index andPageIndex:  (NSUInteger)pageIndex{
    if (([self.pageData count] == 0) || (index >= [self.pageData count])) {
        return nil;
    }

    Topic * topic = (Topic *)[pageData objectAtIndex:index];

    ContentViewController * contentViewController = [[ContentViewController alloc] init];
    [contentViewController setCurrentTopic:topic];
    [contentViewController setCurrentPageIndex:pageIndex];



    return  hadeethViewController;


}

Content View Controller 不会渲染内容,除非它真的被 PageViewContoller 加载。有没有办法在 viewControllerAtIndex 返回之前强制加载视图?或者这种情况有什么解决办法吗?

【问题讨论】:

    标签: uiwebview uipageviewcontroller


    【解决方案1】:

    UIWebView 可以在不在屏幕上时加载内容。我猜你的问题是你的webview只有在你的ContentViewController被初始化之后才会被初始化。如果您已经知道哪些 HTML 文件将通过内容作为用户页面加载,您可以在创建 ContentViewController 之前根据需要在屏幕外 UIWebViews 中预加载它们,并将相应的预加载 UIWebView 添加到内容视图控制器。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-08-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多