1

I have html content which is displayed using UIWebView. User navigate pages using UIPageViewController. The problem is that the web view completes rending the content after the page is displayed. There is noticeable delay makes the performance sluggish.

- (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;


}

The Content View Controller will not render the content unless it is really loaded by the PageViewContoller. Is there any way to enforce the view to load before the viewControllerAtIndex returns? Or is there any solution for such situation?

4

1 回答 1

1

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

于 2013-09-06T17:48:46.613 回答