Reputation: 2262
I am very attracted to the idea of using native components for iOS development, so I am testing the two options currently available: TMS iCL and D.P.F iOS Native Components. Unfortunately I found that both of them have limitations that make them cumbersome or impossible to use, though I still hope that I just overlooked something and therefore I ask here.
Limitation I found:
Here is a simplified edition of what I need. I have 3 forms, a main form with the main menu (as buttons) and two forms I want to slide in. This is the component structure:
MainForm
UINavigationController
UIButtonA
UIButtonB
UIViewController1
FMXwrapper that wraps Form3 (only in TMS iCL)
Form2
UIViewController2
UIButton2
Form3
Various Firemonkey custom controls
Implementation with TMS iCL: FMXwrapper makes it possible to slide in Form3 (which has FMX components), using the command UINavigationController.PushViewController(UIViewController1). I can also slide in UIViewController2, but the components on this form (UIButton2) is not shown, which seem to happen because it is on another form. If TMS iCL really requires all components to be on the same form, then it is useless, unless you make very small apps, but maybe there is a solution to this?
Implementation with D.P.F.: You can actually embed forms from other units, so here I can slide in Form2, but it will only show DPF components on those forms. Therefore sliding in Form3 does not show any components. Is there any solution or workaround to make that work?
Any suggestions how to solve the limitations in either of the component sets?
Upvotes: 2
Views: 1129
Reputation: 2262
I contacted TMS to solve the problem with showing components from other forms. The components simply needs to be initialized on the form first. The simple solution is to quickly show and hide Form2 in MainForm.FormShow. However, with many "hidden" forms it might cause flickering so TMS suggested to make a small function (see below)
As a bonus, here is my evaluation of the two componentsets:
TMS iCL: Simple but stable
D.P.F native controls: Comprehensive but less stable
Conclusion: In the end I decided to buy TMS iCL, for two reasons:
The procedure suggested by TMS:
TMainForm
...
procedure InitializeControl(AControl: TControl);
...
implementation
...
procedure TMainForm.InitializeControl(AControl: TControl);
var I: Integer;
begin
if not Assigned(AControl) then
Exit;
if AControl is TTMSFMXNativeUIBaseControl then
begin
(AControl as TTMSFMXNativeUIBaseControl).Initialize;
for I := 0 to AControl.ControlsCount - 1 do
InitializeControl(AControl.Controls[I]);
end;
end;
...
InitializeControl(Form2.TMSFMXNativeUIViewController2);
Upvotes: 1
Reputation: 1276
Use a UITabBarController on Form1 with multiple tabs (instead of Form2). You can slide between the tabs for native controls.
To get the FMX Form3 to slide in you could set TForm.Transparent := True;. Then use Form3.Show; to show the form. Have a TPanel/TRectangle in Form3 that contains your controls. Set TPanel.Position.X := Screen Width; and then animate sliding it in from the right after TForm.Show;
Upvotes: 1