0

InstagramPathなどのようなアプリケーションを作成しています。トリガーポイントを知る必要があります。ユーザーが一番下までスクロールしてバウンスしたときに、いくつかの呼び出しを行う必要があります。トリガーポイントはどうやって手に入れるの?

4

2 に答える 2

0

以下のコードを確認できます。それはあなたを助けるかもしれません。

- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
    scrollView.contentInset = UIEdgeInsetsMake(0.0, 0.0, 60.0, 0.0);

    [scrollView scrollRectToVisible:CGRectMake(0, scrollView.contentSize.height, scrollView.frame.size.width, 160.0) animated:YES];

    if ([scrollView viewWithTag:5000])
    {
        UIView *view = (UIView*)[scrollView viewWithTag:5000];
        [view removeFromSuperview], view = nil;
    }

    UIView *viewloader = [[[UIView alloc] initWithFrame:CGRectMake(0.0, scrollView.contentSize.height, scrollView.contentSize.width, 160.0)] autorelease];
    viewloader.tag = 5000;

    UILabel *lblloader = [[[UILabel alloc] initWithFrame:CGRectMake(0.0, 0.0, scrollView.frame.size.width-0.0, 60.0)] autorelease];
    lblloader.backgroundColor = [UIColor clearColor];
    lblloader.tag = 550;
    lblloader.textColor = [UIColor whiteColor];
    lblloader.textAlignment = NSTextAlignmentCenter;
    lblloader.text = @"Click to load more data.";
    [viewloader addSubview:lblloader];
    viewloader.backgroundColor = [UIColor darkGrayColor];

    UIButton *btnLoad = [UIButton buttonWithType:UIButtonTypeCustom];
    btnLoad.frame = lblloader.frame;
    btnLoad.backgroundColor = [UIColor clearColor];
    [btnLoad addTarget:self action:@selector(callForMoreData:) forControlEvents:UIControlEventTouchUpInside];
    [viewloader addSubview:btnLoad];

    [scrollView addSubview:viewloader];
}
于 2013-04-09T09:40:56.813 に答える