Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Mockup & CodeGen, iPhone & iPad
($9.99)

Make your own iPhone apps
and run them live!
(free)

Manu
($0.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 03-05-2009, 09:24 PM   #1 (permalink)
Registered Member
 
Join Date: Feb 2009
Posts: 109
Default 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!
brian515 is offline   Reply With Quote
Old 03-05-2009, 09:55 PM   #2 (permalink)
Registered Member
 
tawpie's Avatar
 
Join Date: Jul 2008
Posts: 347
Default

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.
tawpie is offline   Reply With Quote
Old 03-05-2009, 10:00 PM   #3 (permalink)
Registered Member
 
Join Date: Feb 2009
Posts: 109
Default

Quote:
Originally Posted by tawpie View Post
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.
brian515 is offline   Reply With Quote
Old 03-05-2009, 10:02 PM   #4 (permalink)
Tutorial Author
 
Steaps's Avatar
 
Join Date: Oct 2008
Location: Ontario, Canada
Posts: 466
Default

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];
Steaps is offline   Reply With Quote
Old 03-05-2009, 10:05 PM   #5 (permalink)
Registered Member
 
Join Date: Feb 2009
Posts: 109
Talking [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
brian515 is offline   Reply With Quote
Old 03-05-2009, 10:13 PM   #6 (permalink)
Tutorial Author
 
Steaps's Avatar
 
Join Date: Oct 2008
Location: Ontario, Canada
Posts: 466
Default

Quote:
Originally Posted by brian515 View Post
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
Steaps is offline   Reply With Quote
Old 06-02-2009, 11:26 AM   #7 (permalink)
New Member
 
Join Date: May 2009
Location: St. Louis, MO
Posts: 17
Question

Quote:
Originally Posted by Steaps View Post
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?
Newbie09 is offline   Reply With Quote
Old 05-25-2010, 08:55 PM   #8 (permalink)
Registered Member
 
Join Date: Sep 2009
Posts: 2
Default Great thread ...

Quote:
Originally Posted by Steaps View Post
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?
ahalls is offline   Reply With Quote
Reply

Bookmarks

Tags
alloc, core graphis, scale, uiwebview, webview

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» 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
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:45 PM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0