开发者

Animation Problem

开发者 https://www.devze.com 2023-02-13 03:53 出处:网络
i have a view class and a custom button class. view has 4 instances of these custom buttons. custom button class fires an event. view class uses this event and start animation to resize all buttons.

i have a view class and a custom button class. view has 4 instances of these custom buttons.

custom button class fires an event. view class uses this event and start animation to resize all buttons. it maximize the event generator button and minimize others. animation for the event generator button does not work. for other buttons, animation works. animation for the 开发者_运维知识库event generator button behaves like the animation time is zero. it immediately maximize the button.

it seems this code just animates position, not the size. how can i animate the size parameter?

is it bug or it is normal? or is it a ui thread problem?

this code is from view class;

void HandleButtonClick (object sender, EventArgs e)
{
    BestButton[] buttons = { best1, best2, best3, best4 };

    UIView.BeginAnimations ("AnimateLabel");
    UIView.SetAnimationDuration (2);
    UIView.SetAnimationDidStopSelector (new Selector ("didFinishAnimation:"));
    UIView.SetAnimationDelegate (this);

    var max = new RectangleF (0, 0, 320, 460);
    var min = new RectangleF (0, 0, 0, 0);

    foreach (var item in buttons) {
        if (sender == item)
            item.Frame = max;
        else
            item.Frame = min;
        }

    UIView.CommitAnimations ();
}


i found the solution. i deleted this line and everything works now.

UIView.SetAnimationDelegate (this); 
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号