How to run HTML+javascript file run on UIWebView . .?

Question!

Everybody,

I have a one HTML page which contain one Javascript function which shows one animals animation.. i have added it locally in to xcode project.

Now when i load this file in UIWebView it will looks perfect.. Here is the code of loading HTMl file to UIWebView

NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"elephant-animation" ofType:@"html"] isDirectory:NO];
        NSURLRequest *req = [NSURLRequest requestWithURL:url];
        [self performSelectorOnMainThread:@selector(startWebLoad3:) withObject:req waitUntilDone:YES];

-(void)startWebLoad3:(NSURLRequest *)request
{
    [wbView3 loadRequest:request];
    [wbView3 setBackgroundColor:[UIColor clearColor]];
    wbView3.scrollView.scrollEnabled = NO;
    [wbView3.scrollView setBackgroundColor:[UIColor clearColor]];
    [wbView3 setOpaque:NO];
}

But i have 6 pages. When start to load every page with separate UIWebView, It goes to memory warning.. And give me error like here.

void SendDelegateMessage(NSInvocation*): delegate (webView:didFinishLoadForFrame:) failed to return after waiting 10 seconds. main run loop mode: kCFRunLoopDefaultMode

if i run only one page than it run perfectly, but when i start to load all together or one by one it crashed with memory warning.

Let me know if any one get any solution of it..

i have stuck with this problem..

Thanks,



Answers

i think,you want to do html file in webview ,in my application i done one scrollview in that view ,in that view i add webview in loop at last i add the html file in webview. try this code:

ScrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(0,0,768,[[UIScreen mainScreen] bounds].size.height)];
    ScrollView.contentSize = CGSizeMake(768*21,[[UIScreen mainScreen] bounds].size.width);
    ScrollView.pagingEnabled=YES;
    ScrollView.delegate = self;
    ScrollView.userInteractionEnabled = YES;
    ScrollView.showsVerticalScrollIndicator=NO;
    ScrollView.showsHorizontalScrollIndicator=NO;

    int x=0,y=125;
    for ( i=1; i
By : Dev


This video can help you solving your question :)
By: admin