How to animate while resizing UIView

前端 未结 4 1947
一整个雨季
一整个雨季 2021-01-31 20:30

I saw some material on the web, but still can\'t quite get to where I want. I need to animate my view downwards, making it\'s height bigger.

Here is my code so far. What

4条回答
  •  北荒
    北荒 (楼主)
    2021-01-31 20:35

    Can't you just change the frame within a UIView animation block. It looks like that CABasicAnimation is not required in this case.

    [UIView beginAnimations:@"resize_animation" context:NULL];
    // set your duration. a long duration is better to debug
    // 0.1 is really short to understand what is going wrong
    [UIView setAnimationDuration:2]; 
    
    btnHead.frame = newFrame;
    
    [UIView commitAnimations];
    

提交回复
热议问题