iphone - 如何为我的 View 调整大小设置动画?

标签 iphone objective-c cocoa-touch animation uianimation

我正在调整表格 headerView 的大小。我想为它制作动画,但我不确定怎么做。

-(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];

}

最佳答案

这应该可以解决问题。

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

关于iphone - 如何为我的 View 调整大小设置动画?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/3713562/

相关文章:

ios - 在 UITextView 中捕获滚动 Action

ios - 有没有办法从 Iphone 获取信号强度?

ios - 如何获取 UISwitch 的值?

cocoa-touch - 如何将标签栏项目连接到操作?

ios - 问答 - 如何强制设备方向在横向和纵向之间旋转

objective-c - CGRectApplyAffineTransform 什么都不做?

objective-c - 如何制作字幕 UILabel/UITextField/NSTextField

javascript - jQuery:在用户点击 Iphone 时播放音频

iphone - 如何将 UITableView 的背景设置为图像?

iphone - 将 Long Long 数除以百分比