将UITableView滑出屏幕?

时间:2012-06-05 13:06:14

标签: objective-c ipad uitableview animation

我正试图在屏幕上滑动我的UITableView动画,我在下面尝试过这个但没有成功:

-(void)slideTableViewOffScreen
{
    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:0.5];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
    [UIView setAnimationDelegate:self];

    stageSelectionTable.frame = CGRectMake(stageSelectionTable.frame.origin.x - stageSelectionTable.frame.size.width, stageSelectionTable.frame.origin.y, stageSelectionTable.frame.size.height, stageSelectionTable.frame.size.width);

    [UIView commitAnimations];
}

为什么它可能不起作用的任何想法,或者我需要做什么才能使这个动画工作?调用该代码时,没有任何反应。

1 个答案:

答案 0 :(得分:0)

原来这个代码没有任何奇怪的效果:

-(void)slideTableViewOffScreen
{
    CGRect newFrame = stageSelectionTable.frame;
    newFrame.origin.x -= 130;

    [UIView beginAnimations:nil context:nil];
    [UIView setAnimationDuration:0.5];
    [UIView setAnimationCurve:UIViewAnimationCurveEaseOut];
    [UIView setAnimationDelegate:self];

    stageSelectionTable.frame = newFrame;

    [UIView commitAnimations];
}
相关问题