As a matter of fact, the chance of using native iOS APIs in Delphi opens a whole world of possibilities.
So I am trying to embed a Form (or UIVIew belonging to other form). With firemonkey controls, this is easy:
// AParentControl can be any control, such as a panel or a tabsheet item of a TabControl.
procedure TMainForm.EmbeddForm(AParentControl:TControl; AForm:TCustomForm);
begin
while AForm.ChildrenCount>0 do
AForm.Children[0].Parent:=AParent;
end;
However, as expected, this is not working with iOS Native controls.
Does anybody know how can we achieve this using native UIViews ?
With DPF animation system, we can swap different UIViews inside a "mother" UIView. So, I think it must be possible to do this with UIViews belonging to different forms.
However, at the moment, I have not been able to do this even with UIViews from the very same form.
Any help will be appreciated!
If you would like to refer to this comment somewhere else in this project, copy and paste the following link:
At this demo, there is not "Push/slide" effect because the method I used in order to get this has nothing to do with the current implemented animations.
(I'll post the FormWrap with slide animation later).
By the way, I found another bug. This time I had not time to fix it. If you put a DPFButton in an embedded form, and later, you nil that form with UIView.Form:=nil. And later, you try to assign the same form to that UIView, it crashes creating the subview of the Button.
It is really a weird thing since it only happens if you drop a DPFButton1 and only the second time you embed that form.
If you want to reproduce it, just add a DPFButton into the Form1 of the attached demo. Run it and press the buttons: "Go Form2" and then "Back Form1".
As I promised before, here it is the Form Transition with slide animation.
I couldn´t use the iOSAPI.QUartzcore because the TransitionPush isn´t implemented yet by embarcadero. However, I managed to get a nice "Push/Slide" transition Using 3 UIViews (Main View, SourceView and DestinationView). This transition hasn´t any problem with DPFButton like previous demo.
By the way Babak, could you change the default Toolbar Buttons Height? I think is too narrow at the moment (2 pixels more would be great).
As a matter of fact, the chance of using native iOS APIs in Delphi opens a whole world of possibilities.
So I am trying to embed a Form (or UIVIew belonging to other form). With firemonkey controls, this is easy:
// AParentControl can be any control, such as a panel or a tabsheet item of a TabControl.
procedure TMainForm.EmbeddForm(AParentControl:TControl; AForm:TCustomForm);
begin
while AForm.ChildrenCount>0 do
AForm.Children[0].Parent:=AParent;
end;
However, as expected, this is not working with iOS Native controls.
Does anybody know how can we achieve this using native UIViews ?
With DPF animation system, we can swap different UIViews inside a "mother" UIView. So, I think it must be possible to do this with UIViews belonging to different forms.
However, at the moment, I have not been able to do this even with UIViews from the very same form.
Any help will be appreciated!
I managed to get the solution using the AddSubView procedure.
Now I am trying to animate it. I will post a demo as soon as I finish!
Hi Diego,
I added this in DPF.iOS.UIView.pas with Form property,
you will see it in next release,
I'm waiting for your animation demo for this,
thank you
Last edit: Babak Yaghoobi 2013-07-09
It is really cool to have this new feature as part of the components!
I detected a bug when you set an UIView.Form:=nil;
If the form has/owns more than one component (all of them detected as subviews), it crashes when you try to null it.
This bug is located at DPF.IOS.UIView.pas file, inside the clearAllSubviews procedure.
You have to change the
with
With this change, it should work properly.
I'm working on the demo already!
Greetings!
Hi Diego,
Thank you for your feedback,
I cant reproduce this bug!
Can you send me a sample to review how did this happen ?
Thank you
Last edit: Babak Yaghoobi 2013-07-10
Ok, I found it, and fixed.
Thank you for feedback
Ok, I see you have found it!
I have already finished the transition demo. However, I'm trying to get a "push" animation like the Navigation bar in iOS.
I think I can achieve this using the QuartzCore API...
As soon as I get it I will post it!
Greetings
Last edit: Diego 2013-07-10
Here I attached the FormWrap with transitions.
At this demo, there is not "Push/slide" effect because the method I used in order to get this has nothing to do with the current implemented animations.
(I'll post the FormWrap with slide animation later).
By the way, I found another bug. This time I had not time to fix it. If you put a DPFButton in an embedded form, and later, you nil that form with UIView.Form:=nil. And later, you try to assign the same form to that UIView, it crashes creating the subview of the Button.
It is really a weird thing since it only happens if you drop a DPFButton1 and only the second time you embed that form.
If you want to reproduce it, just add a DPFButton into the Form1 of the attached demo. Run it and press the buttons: "Go Form2" and then "Back Form1".
If no Button added, everything works ok.
As I promised before, here it is the Form Transition with slide animation.
I couldn´t use the iOSAPI.QUartzcore because the TransitionPush isn´t implemented yet by embarcadero. However, I managed to get a nice "Push/Slide" transition Using 3 UIViews (Main View, SourceView and DestinationView). This transition hasn´t any problem with DPFButton like previous demo.
By the way Babak, could you change the default Toolbar Buttons Height? I think is too narrow at the moment (2 pixels more would be great).
I hope my demos can be useful!
Greetings
Thank you Diego, this very good and useful demo
I added this in demo list,
We cant change System Toolbar button height, the fixed size is 20
Thank you again for demo
You are welcome.
Take into account that I wrote two posts with two different demos.
Could you find the bug with DPFButton I told you about in my previous post?
Hi Diego,
I see this demo and fixed bugs.
Thank you for good feedbacks