1
votes

I am trying to view the web-page in UIWebView in iOS. Below is the link I am trying to view.

http://almaktab.com/forms/flight.html

The problem is width of table is 255px and when I open this in webview, it covers only half screen which looks odd. Below is the code I am using for viewing web page in UIWebView.

-(void)openWebPage:(NSString*)address {
    NSURL*url=[NSURL URLWithString:address];
    NSURLRequest*request=[NSURLRequest requestWithURL:url];
    myWebView.scalesPageToFit = YES;
    myWebView.autoresizingMask = UIViewAutoresizingFlexibleWidth;
    myWebView.contentMode = UIViewContentModeScaleAspectFit;
    myWebView.autoresizesSubviews = YES;
    [myWebView loadRequest:request];
    [myWebView setAutoresizingMask:(UIViewAutoresizingFlexibleHeight | UIViewAutoresizingFlexibleWidth)];
}

I want to stretch this webview so that form can fit for whole page.


I know solution for this would be width=100%, but client don't want to do any changes in their website now. Client asked to do changes in iOS only.

Any idea how this can be get done.


Screenshot (myWebView.scalesPageToFit = YES;)

enter image description here

Screenshot (myWebView.scalesPageToFit = NO;)

enter image description here

2
set the UIWebView property scalesPageToFit to FALSE. - Mudit Bajpai
May be you should calculate of center for myWebView.frame? - stosha
will you attache the screen shot. please. - Prateek Prem
@PrateekPrem : Attached... - Fahim Parkar
@MuditBajpai : Done, attached is the screenshot... but its not going full screen - Fahim Parkar

2 Answers

0
votes

Try:

webView.scalesPageToFit = NO;

And in webViewDidFinishLoad:

[view stringByEvaluatingJavaScriptFromString:@"document.getElementById('table3').width='100%'"];
0
votes

You should have not use AutoresizingMask.