0

在我的视图控制器中,在滚动视图中输入了所有对象。scrollView 中的一个按钮会创建一个动画。

滚动视图离开页面 -80.0 orgine.y 到目前为止一切顺利.. 现在我希望当您单击按钮时滚动视图然后返回到 -80.0 到 +80.0 自动返回到其原始位置,所以......你能告诉我最好的方法吗?

这是按下时完成我的按钮的动作......

- (IBAction)AcceptFriendRequest:(id)sender {

    PFObject *SelectedUser = [self.UtentiInAttesa objectAtIndex:[sender tag]];
    [SelectedUser setObject:@"Confermato" forKey:@"STATO"];

    [SelectedUser saveInBackground];



     [UIView beginAnimations:nil context:NULL];
     [UIView setAnimationDelegate:self];
     [UIView setAnimationDuration:0.2];
     [UIView setAnimationBeginsFromCurrentState:YES];
     FFScrollView.frame = CGRectMake(FFScrollView.frame.origin.x, (FFScrollView.frame.origin.y - 80.0), FFScrollView.frame.size.width, FFScrollView.frame.size.height);
        [UIView setAnimationRepeatAutoreverses:YES];

     [UIView commitAnimations];



}
4

1 回答 1

1

在您的按钮事件处理程序中

- (IBAction)myBtnClicked:(id)sender {
    // Create new CGRect indicate place where you would scroll to.
    // Assume it is called `originalRect`
    // Use the following method, it should work
    [FFScrollView.scroll scrollRectToVisible:originalRect animated:YES];
}
于 2013-10-27T04:20:28.430 回答