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

tomgoo

macrumors newbie
Original poster
Jun 30, 2012
3
0
Hi guys, I've got this code here for a particular URL which I don't want to scale to fit on my webview, but I want all other pages to have the scale to fit function. The problem is, it doesn't do anything. I've tried switching round the scalepagestofit code snippets and it will work the other way round?

any help is appreciated!

Code:
if(currentURL==@"http://www.myurl.co.uk/search1.php") {
     
        webView.scalesPageToFit=FALSE;
        
  
        
    } else {
        
        webView.scalesPageToFit=TRUE;
    }

This code is in my viewDidLoad, webView is a weak property? That's about all the details I think.

Thanks,

Tom
 
Last edited by a moderator:
Using the == operator is not the proper way to compare strings.

Thanks, I've changed it to this now: (with extra parenthesis I think is right):


Code:
NSString *currentURL = webView.request.URL.absoluteString;
    
    if((currentURL=@"http://www.myurl.co.uk/search1.php")) {
     
        webView.scalesPageToFit=FALSE;
        
  
        
    } else {
        
        webView.scalesPageToFit=TRUE;
    }


But it's still not working for some reason?
 
Last edited by a moderator:
You're now attempting to use the = assignment operator. That definitely won't work! Look at the documentation for the NSString class. See if there's an instance method that might tell you if your URL is equal to a string.
 
You're now attempting to use the = assignment operator. That definitely won't work! Look at the documentation for the NSString class. See if there's an instance method that might tell you if your URL is equal to a string.

I've found this:

stringWithContentsOfURL:encoding:error:

but I don't think this instance method will work with it?
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.