Getting TWebBrowser on iOS to zoom

Posted by on in Blogs
There's currently an issue with TWebBrowser in that it doesn't allow for zooming. Luckily it's fairly easy to fix.

I suggest that you make a copy of FMX.WebBrowser.iOS.pas and put it in the same directory as your project. You then add it to your project. This way it will be picked up automagically.

Now for the hardest part... ;)

Make the following change in FMX.WebBrowser.iOS.pas (your copy).

constructor TiOSWebBrowserService.Create;
FWebView := TUIWebView.Create;
FWebView.setScalesPageToFit(true); // Add this line of code
FDelegate := TiOSWebViewDelegate.Create;

Thanks Sarina for the tip!


  • Guest
    Emrah KUCUKALI Wednesday, 15 May 2013

    I tried to play youtube videos (only video) on ios app. Video component doesnt support and i thought maybe webbrowser can do, but there is an another problem that twebbrowser doesnt have source property! How can do that?

  • Guest
    jed Wednesday, 15 May 2013

    This just highlights an issue with wrapping native controls - You need to give us access to the actual native control.

    How can a developer be confident with native wrappers when things like this are missed. Are we expected to have to wait for the next major version to be released to have this fixed?

    When is an update for XE4 coming?

  • Guest
    Charles Stack Thursday, 16 May 2013

    Thanks for the tip.

    Jed does bring up some good points regarding native controls - As you pet peeve is Push Notifications (still can't get the example posted in your other entry to work).

    I would love to see (in order) in the next update:
    1. Ability to use our own provisioning profiles during development.
    2. Push Notifications code (vs a hack) out of the box that works.
    3. Documentation showing HOW and when to call native iOS functions.
    4. More complete native control wrappers (and exposing more capabilities of existing ones).
    5. Android and/or Windows 8 Store support. wish list. :-)

    I am, however, very pleased with this latest release despite the changes in the language (one String type is taking some time to get used to...but, I understand WHY it was done).

    Now...I need to get back to a company that is, on their job posting, listing and, I quote, "Older Programmer Languages - Delphi"). We need to break that perception!

  • Guest
    Karu Kaarigar Tuesday, 21 May 2013

    Hi Anders,

    Can you briefly share how to handle single-tap and double-tap of the iOS device screen? Double-tap is not a problem - the GestureManager allows for it. However, I am forced to use Click or MouseDown event handler as a single-tap handler. But the problem is that the MouseDown and Click events also get fired when a double-tap event occurs. Is there anyway to handle these events without any logic conflicts?

  • Please login first in order for you to submit comments
  • Page :
  • 1

Check out more tips and tricks in this development video: