03-05-2009, 09:24 PM
#1 (permalink )
Registered Member
Join Date: Feb 2009
Posts: 109
Resizing a Web View that has already been created
Hi,
I made a webview in interface builder, and I want it to scale down to half the width, and the same hight on an IBAction. So I used the CGAffineTransformMakeScale to resize scale the view. The only problem is that the webpage inside of the webview gets scaled with the view, and therefore is distorted. Is there a way to make my webview resize instead of scale so that the content does not get scaled with the webview as well? Thanks!
03-05-2009, 09:55 PM
#2 (permalink )
Registered Member
Join Date: Jul 2008
Posts: 347
have you tried resetting the .frame property of your webView? I haven't played with webViews, but UIView allows changing the size and location of the frame at will.
03-05-2009, 10:00 PM
#3 (permalink )
Registered Member
Join Date: Feb 2009
Posts: 109
Quote:
Originally Posted by
tawpie
have you tried resetting the .frame property of your webView? I haven't played with webViews, but UIView allows changing the size and location of the frame at will.
How would I do that? Sorry if this is a rudimentary question.
I also forgot to mention, I tried doing:
Code:
webView1 = [[UIWebView alloc] initWithFrame:(CGRectMake:0.0, 0.0, 240.0, 320.0)];
to no avail.
Yes, I did declare webView1 as an instance in the .h.
03-05-2009, 10:02 PM
#4 (permalink )
Tutorial Author
Join Date: Oct 2008
Location: Ontario, Canada
Posts: 466
Code:
webView.frame = CGRectMake(webView.frame.origin.x, webView.frame.origin.y, webView.frame.size.width / 2, webView.frame.size.height);
That should do the trick. It might need to be refreshed, not sure, but i don't think so.
EDIT: Are you adding the WebView to the Subview?
Code:
[self.view addSubview:webView];
03-05-2009, 10:05 PM
#5 (permalink )
Registered Member
Join Date: Feb 2009
Posts: 109
[SOLVED]
Thanks a ton for your speedy reply. Setting the frame properties did the trick!
I can't believe it was that simple!
Last edited by brian515; 03-05-2009 at 10:20 PM .
Reason: Forgot to mark Solved
03-05-2009, 10:13 PM
#6 (permalink )
Tutorial Author
Join Date: Oct 2008
Location: Ontario, Canada
Posts: 466
Quote:
Originally Posted by
brian515
Thanks a ton for your speedy reply. Setting the frame properties did the trick!
I can't believe it was that simple!
No problem (I think it was me who helped, if not, this is embarrassing
).
Remember to put [SOLVED] in the title to help others
.
http://www.iphonedevsdk.com/forum/ne...rk-solved.html
06-02-2009, 11:26 AM
#7 (permalink )
New Member
Join Date: May 2009
Location: St. Louis, MO
Posts: 17
Quote:
Originally Posted by
Steaps
Code:
webView.frame = CGRectMake(webView.frame.origin.x, webView.frame.origin.y, webView.frame.size.width / 2, webView.frame.size.height);
That should do the trick. It might need to be refreshed, not sure, but i don't think so.
EDIT: Are you adding the WebView to the Subview?
Code:
[self.view addSubview:webView];
I have the same problem.
http://www.iphonedevsdk.com/forum/ip...ide-frame.html
CGRect smallViewRect = CGRectMake(0, 310, 320, 150);
[smallView frame:smallViewRect];
[homeView addSubview:smallView];
This almost does the same stuff that you did in your example. This does not work for me. What could be the reason?
05-25-2010, 08:55 PM
#8 (permalink )
Registered Member
Join Date: Sep 2009
Posts: 2
Great thread ...
Quote:
Originally Posted by
Steaps
Code:
webView.frame = CGRectMake(webView.frame.origin.x, webView.frame.origin.y, webView.frame.size.width / 2, webView.frame.size.height);
That should do the trick. It might need to be refreshed, not sure, but i don't think so.
This is a great thread ... but how can I detect that the UIWebView is not big enough and how big it should be?
Thread Tools
Display Modes
Linear Mode
Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
» Advertisements
» Online Users: 254
22 members and 232 guests
14DEV , @sandris , ADY , ArtieFufkin10 , bookesp , ckgni , dacapo , Dani77 , DarkAn , Davey555 , Desert Diva , HemiMG , iDifferent , jakerocheleau , JasonR , prchn4christ , Rudy , ryantcb , Speed , theone8one
Most users ever online was 1,187, 10-11-2011 at 08:09 AM.
» Stats
Members: 158,885
Threads: 89,230
Posts: 380,767
Top Poster: BrianSlick (7,129)
Welcome to our newest member, bookesp