UIScrollView的滚动的UIView [英] UiScrollView scrolling UiView

查看:197
本文介绍了UIScrollView的滚动的UIView的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在我的ViewController输入在一个滚动视图的所有对象。一项所述的滚动视图内的按钮中的创建动画。

滚动视图下车-80.0页面orgine.y
到目前为止好。现在我想,当你点击按钮滚动视图,然后进入回落到-80.0至80.0自动返回到原来的位置所以......你能告诉我最好的方法,让你有此?

这是一个符合当推我的按钮的动作...

   - (IBAction为)AcceptFriendRequest:(ID)发送{    PFObject * SelectedUser = [self.UtentiInAttesa objectAtIndex:[发送方标记]];
    [SelectedUser的setObject:@ConfermatoforKey:@STATO];    [SelectedUser saveInBackground]     [UIView的beginAnimations:无背景:NULL];
     [UIView的setAnimationDelegate:个体经营];
     [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];}


解决方案

在您的按钮事件处理程序

   - (IBAction为)myBtnClicked:(ID)发送{
    //创建新的CGRect指示的地方,你会滚动到。
    //假定它被称为'originalRect`
    //使用下面的方法,它应该工作
    [FFScrollView.scroll scrollRectToVisible:originalRect动画:YES];
}

in my viewcontroller entered all the objects in a scrollview. One of the buttons inside the scrollView creates an animation.

The scrollView get off the page -80.0 orgine.y So far so good .. Now I want that when you click on the button the scrollview and then goes back down to -80.0 to +80.0 automatically returning to its original position so ... Can you tell me the best method for you to have this?

This is the action that fulfills my button when pushed ...

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



}

解决方案

In your button event handler

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

这篇关于UIScrollView的滚动的UIView的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆