presentViewController from second form

Hi,

I want to show a TTMSFMXNativeUIViewController (containing some controls) which resides on Form2 in Form1 as a modal FormSheet:

procedure TForm1.TMSFMXNativeUIButton1Click(Sender: TObject);
begin
  Application.CreateForm(TForm2, Form2);
  Form2.TMSFMXNativeUIView1.ViewController.setModalPresentationStyle(UIModalPresentationFormSheet);
  GetRootViewController.presentViewController(Form2.TMSFMXNativeUIView1.ViewController, true, nil);
end;

The problem is:
When "Form2.visible := true" then the screen flickers when creating Form2 because the controls are getting visible.
When "Form2.visible := false" then no controls are shown.

What can I do?

Thanks in advance,
Dietrich


You could create the form in the constructor of the first form and then show it? It's unclear exactly what is flickering, but I assume creating the controls during main form creation should avoid flickering when showing the form.

when I create form2 in the constructor of form1 then when you rotate the real device (IPad AIR 11.4) form2 sees through form1 while rotating - very ugly. It seems like form1 is getting transparent while rotating ...

On the simulator (Ipad AIR 10.3)  form1 doesn't get transparent so form2 does not show through.

It's unclear exactly if this is an FMX issue or if this is related to our components. What you can possibly do is wrap everything in a Parent UIView and hide the UIView, then create the form and show the UIView after the viewcontroller is presented?

this helps:

Application.CreateForm(TForm2, Form2); <- where Form2.TMSFMXNativeUIView1.visible is false

Form2.TMSFMXNativeUIView1.ViewController.setModalPresentationStyle(UIModalPresentationFormSheet);
GetRootViewController.presentViewController(Form2.TMSFMXNativeUIView1.ViewController, true, nil);

Form2.TMSFMXNativeUIView1.visible := true;

Form2.TMSFMXNativeUIView1.inizialize; <- also its children

Thanks !