All Blog Posts  |  Next Post  |  Previous Post

Block Animations with TMS iCL


Wednesday, July 3, 2013

This week, we had a support question on Block Animations with TMS iCL, or in other words, how to animate for example a TTMSFMXNativeUIView?

To be honest, after all the hard work around the TMS iCL components, demos and documentation there wasn't room left for some more diving inside the iOS frameworks and features, so we couldn't really answer YES to the question until it was sorted out if it was even possible. When we got the question about Block Animations we were really curious if it would actually do anything since we are not working directly in XCode with the native language. So we dropped everything and started testing.

It was clear that even this feature of the iOS core animation framework would work as expected without any issues. We dropped a TTMSFMXNativeUIView instance on the form, dropped a button with the following code:

TUIView.OCClass.beginAnimations(nil, nil);  
TMSFMXNativeUIView1.SetBounds(0, 0, 320, 480);  
and some initialization to position the view out of sight:
TMSFMXNativeUIView1.SetBounds(0, 480, 320, 480); 
Starting the application and clicking the button slides the view in from the bottom.

This is only a basic animation and in the documentation of Block Animations there were some more complex samples such as animating the alpha of a component and the animation curve. The next sample animates a flip on the view and shows a second view:
  vwRemove, vwAdd: TTMSFMXNativeUIView;
  vwRemove := nil;
  vwAdd := nil;
  if Assigned(TMSFMXNativeUIView1.Parent) then
    vwRemove := TMSFMXNativeUIView1;
    vwAdd := TMSFMXNativeUIView2;
  else if Assigned(TMSFMXNativeUIView2.Parent) then
    vwRemove := TMSFMXNativeUIView2;
    vwAdd := TMSFMXNativeUIView1;

  if Assigned(vwRemove) and Assigned(vwAdd) then
    TUIView.OCClass.beginAnimations(nil, nil);
    TUIView.OCClass.setAnimationTransition(UIViewAnimationTransitionFlipFromLeft, TMSFMXNativeUIView3.View, False);
    vwRemove.Parent := nil;
    vwAdd.Parent := TMSFMXNativeUIView3;
The demo for this code can be found at the following link:

Pieter Scheldeman


This blog post has not received any comments yet.

Add a new comment

You will receive a confirmation mail with a link to validate your comment, please use a valid email address.
All fields are required.

All Blog Posts  |  Next Post  |  Previous Post