Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

yaniv92648

macrumors member
Original poster
Oct 26, 2009
96
0
Hi,
how do i hide/remove the address bar from the UIWebView?
how do i scroll programmtically a UIWebView?
Thanks!
 
thanks for the scroll part,

and the UIWebView does have an address bar, i'm doing loadRequest and on top of the web view there's a bar inwhich there a coordinates of the a specific location. i wanna hide that bar.
 
and the UIWebView does have an address bar, i'm doing loadRequest and on top of the web view there's a bar inwhich there a coordinates of the a specific location. i wanna hide that bar.

How have you created this UIWebView? When I create mine (which I do all in code, no Interface Builder) I don't get address bars. Maybe if you create them in Interface Builder you get an address bar?
 
all from code, no IB at all

UIWebView *webView = [[UIWebView alloc] initWithFrame:CGRectMake(10, 80, 300, 200)];
[webView setScalesPageToFit:YES];
CGFloat currentLatitude = [[Order sharedOrder] location].latitude;
CGFloat currentLongitude = [[Order sharedOrder] location].longitude;
NSString *currentLocationString = [NSString stringWithFormat:mad:"%f,%f", currentLatitude, currentLongitude];
NSString *urlString = [NSString stringWithFormat:mad:"http://maps.google.com/maps?q=%@&z=15", currentLocationString]; // z - zoom
[webView loadRequest:[NSURLRequest requestWithURL:[NSURL URLWithString:urlString]]];
[self.view addSubview:webView];
[webView release];
 
Hmm, very odd. Can you post a screenshot of what you are getting. The only thing I do that you don't is set the webview delegate...
 
screenshot

thank u
 

Attachments

  • Picture 3.png
    Picture 3.png
    10.4 KB · Views: 1,138
Is that address bar within the frame of your webview? As it might be part of the webpage Google has served up. Otherwise it certainly doesn't look like a standard Apple provided control...
 
No one said that. You will simply have to get more creative. I would have though that a bit of JavaScript/DOM action could remove it.
 
actually..

in my case, there's a UILabel right above it, i could color the background of the label and hide the webview beneath the label, i kinda wanted something simpler.. but thank u all guys..
 
You probably should look into the Google Maps API and see if they have provided any mechanism to turn off that bar.


P.S. And if you are using a UIWebView to provide only a Google Maps view, you should probably just consider using MKMapView.
 
i solved it at last...

apparently javaScript is the only solution both to scroll and to hide the damn address bar..
[webView stringByEvaluatingJavaScriptFromString:mad:"window.scrollTo(0, 120);"];
the line above solved both of my problems.
again, Thank u all for u'r help.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.