Prettier iOS Development on Windows

If, like me, you’re doing your Delphi iOS development on Windows then your probably making use of the compiler’s ability to compile and run your app on Win32. You’re probably also fed up with how dreadful your apps look during testing on Windows.

Wouldn’t it be great if you could load the proper iOS styles on Windows? Sadly the true iOS styles are locked away somewhere within Delphi. But there are a couple of custom styles available for iOS and it’s a simple process to load them into your app.

Start with your DPR file (select Project|View Source from the main menu). Add FMX.Styles to the uses list, and add the three lines shown below at the start of the code.

program MarginMarkup;

Calculator in 'Calculator.pas' {CalculatorForm},
Calculator.VM in 'Calculator.VM.pas';

{$R *.res}

.SetStyleFromFile('C:\Users\Public\Documents\RAD Studio\12.0\Styles\iOS\iOSBlack.fsf');
Application.FormFactor.Orientations := [TFormOrientation.soPortraitTFormOrientation.soInvertedPortrait];

The lines you need to add are the first three after the begin statement. The $IFDEF ensures that our code only compiles if Windows is the target. The line between loads the system style from the file specified (.fsf is a binary style file - you can also load .style files). The above code shows the default installation location for the files.

In addition to the iOSBlack style named above there’s also an iOSTransparent file in the same folder. There are also two premium styles available for download from Embarcadero’s registered downloads area, with each style available in both iOS 7 and non-iOS 7 versions.

The image below shows the iOS7Jet style running under Windows 8.

Commenting is not available in this channel entry.