Register FAQ / Rules Forum Spy Search Today's Posts Mark Forums Read
Go Back   MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Reply
 
Thread Tools Search this Thread Display Modes
Old Feb 20, 2012, 03:31 PM   #1
Danneman101
macrumors 6502
 
Join Date: Aug 2008
Resize UIWebView?

Is it possible to resize a UIWebView via code?

The reason I want to do this is because I have a ToolBar with navigation-buttons that appears each time the webview is touched, and disappears when the user clicks a hide-button.

The problem is that the toolbar is displayed on top of the webview, thus sometimes making stuff on the webpage untouchable.

The perfect solution would be the ability to resize the webview when the toolbar appears and disappears, but so far I have not found any solution.

Any ideas would be welcome.
Danneman101 is offline   0 Reply With Quote
Old Feb 20, 2012, 05:14 PM   #2
PhoneyDeveloper
macrumors 68020
 
PhoneyDeveloper's Avatar
 
Join Date: Sep 2008
You might want the toolbar to disappear by itself after a period of time.

If not then the web view has a frame like every other view. Just adjust the frame to make the web view bigger and smaller when needed.
PhoneyDeveloper is offline   0 Reply With Quote
Old Feb 20, 2012, 05:28 PM   #3
Danneman101
Thread Starter
macrumors 6502
 
Join Date: Aug 2008
Ah, yes, forgot about that - adjusting the frame should work (using setFrame)!

Thanks a lot
Danneman101 is offline   0 Reply With Quote
Old Feb 20, 2012, 06:01 PM   #4
Danneman101
Thread Starter
macrumors 6502
 
Join Date: Aug 2008
This code works perfectly for my needs.

Code:
    // Resize:  Webview height small (toolbar opened)
    CGRect newFrame = webView.frame;
    newFrame.size = CGSizeMake(self.webView.frame.size.width, self.toolBar.frame.origin.y);
    webView.frame = newFrame;

    // Resize:  Webview height Full (toolbar closed)
    CGRect newFrame = webView.frame;
    newFrame.size = CGSizeMake(self.webView.frame.size.width, (self.toolBar.frame.origin.y + self.toolBar.frame.size.height) );    
    webView.frame = newFrame;
Danneman101 is offline   0 Reply With Quote

Reply
MacRumors Forums > Apple Systems and Services > Programming > iPhone/iPad Programming

Thread Tools Search this Thread
Search this Thread:

Advanced Search
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

Forum Jump

Similar Threads
thread Thread Starter Forum Replies Last Post
Keep UIWebView from entering mobile site Wellington2k iPhone/iPad Programming 3 Dec 4, 2011 08:06 AM
Getting Information from XML and displaying it on a UIWebView ashwinr87 iPhone/iPad Programming 1 Oct 3, 2011 02:24 PM
Right Click > Resize image kamalds Mac Applications and Mac App Store 2 Sep 24, 2011 05:34 AM
Resizing UIWebViews in the background so the main UI doesn't lag? MythicFrost iPhone/iPad Programming 0 Mar 6, 2011 12:50 AM
How do I get links in a pdf displayed in a UIWebView to work John Baughman iPhone/iPad Programming 0 Dec 29, 2010 11:59 AM


All times are GMT -5. The time now is 11:09 PM.

Mac Rumors | Mac | iPhone | iPhone Game Reviews | iPhone Apps

Mobile Version | Fixed | Fluid | Fluid HD
Copyright 2002-2013, MacRumors.com, LLC