简体   繁体   English

如何设置我的视图大小调整动画?

[英]How can I animate my view resizing?

I am resizing my tables headerView. 我正在调整我的表headerView。 I want to animate it, but I am not sure how. 我想给它制作动画,但我不确定如何。

-(void)layoutForBanner
{
    // Depending on if the banner has been loaded, we adjust the content frame and banner location
    // to accomodate the ad being on or off screen.
    // This layout is for an ad at the bottom of the view.
    if(banner.bannerLoaded)
    {
        headerView.frame = CGRectMake(0, 0, 320, 94);
    }
    else
    {
        headerView.frame = CGRectMake(0, 0, 320, 50);
    }   

    [self.tableView setTableHeaderView:headerView];

}

This should do the trick. 这应该可以解决问题。

[UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:.5];
    headerView.frame = CGRectMake(0, 0, 320, 50);
    [UIView commitAnimations];

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM