Titanium JIRA Archive
Titanium SDK/CLI (TIMOB)

[TIMOB-2229] iOS: animate does not change the property value

GitHub Issuen/a
TypeBug
PriorityTrivial
StatusClosed
ResolutionWon't Fix
Resolution Date2011-12-04T16:34:26.000+0000
Affected Version/sRelease 1.6.0
Fix Version/sn/a
ComponentsiOS
Labelsparity
Reporternetspy
AssigneeReggie Seagraves
Created2011-04-15T03:14:12.000+0000
Updated2012-02-10T00:48:36.000+0000

Description

If I animate an property of an ui element, the property does not change the value after animation.

Example:

var search = Titanium.UI.createSearchBar({
  height: 43,
  top: -43
});
win.add(search);
search.animate({top:0});
Ti.API.info(search.top);

Output: -43
Expected result: 0

The search bar is animated but the top property has not changed the value.

Comments

  1. Don Thorp 2011-10-07

    This is not a bug in animation. The bug is expecting a layout parameter to be updated after an animation. We will be adding contentRect or something equivalent which will tell you where your view is on the display in the next release.
  2. Don Thorp 2011-11-05

    This may be expected behavior. Final value can be set on end event.
  3. Ignacio Torres Masdeu 2011-11-14

    If I animate an object from point a to point b, I expect the view state to reflect that movement. Setting the final value with a 'complete' event feels hacky. I understand that my reasoning is not correct, could you explain why the current behavior is the expected one?
  4. Keith Gable 2011-12-01

  5. Don Thorp 2011-12-01

    Keith, just to clarify layout parameters aren't the same as view properties. It was a bug in iOS that height was changed to be the current height for example. When height is "auto" it should stay that way so that when orientation changes occur the information is still available to layout the display. For example if you set width 50% and as soon as the view is drawn it changes to 150 then you've lost the layout configuration when other container views change. I'm sending a note to our doc go to talk about this in the animation as you suggest.
  6. Keith Gable 2011-12-02

    Is there a way to access the view's active properties? I understand there is a separation between the native object's current properties and the view object's properties, but if views can be moved around onscreen without exposing their current positions somewhere, it seems buggy at best.
  7. Tony Lukasavage 2011-12-02

    You can use a view's size property to get the view's active properties. For example, if you set the initial layout value of an ios view to have a width of 50%, the value in view.size.width would be 160. The size property is a dictionary that looks like this:
       {
           x: 0,
           y: 0,
           width: 0,
           height: 0
       }
       
  8. Arthur Evans 2011-12-02

    Note that the size property only gives you the object's size (as the name suggests). As Don said in his first comment, the position half of the equation is missing. This is a known issue. The current situation is frustrating. But I will document it for 1.8.0 so it isn't frustrating AND mysterious.
  9. Don Thorp 2011-12-04

    See the comments. APIDoc is being added to help.

JSON Source