Reputation: 300
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?
Upvotes: 1
Views: 797
Reputation: 6747
UIWebView
can load content while not on screen. I'm guessing your issue is that your webview gets initialized only after your ContentViewController
has been initialized. If you already know which HTML files will be loaded as your user pages through the content you can preload them as necessary in off-screen UIWebViews before creating the ContentViewController
and add the corresponding, pre-loaded UIWebView to the content view controller.
Upvotes: 1