0

我正在尝试使我的 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];
}

有什么想法为什么它可能不起作用,或者我需要做什么才能使这个动画起作用?当调用该代码时,什么也没有发生。

4

1 回答 1

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];
}
于 2012-06-05T13:43:10.720 回答