为什么UIScrollView不会调用它的委托?

时间:2012-07-27 15:31:52

标签: iphone xcode delegates uiscrollview uiscrollviewdelegate

问题是我在Xib上创建了一个新的UIScrollView,然后将委托链接到所有者.. 一些代表如何调用..任何线索?或UIScrollView的简单示例

抱歉,我是新的ios开发人员并提前感谢..

代码:

在标题

@interface stageViewController : UIViewController<UIScrollViewDelegate>

at .m

#pragma mark drag delegate
- (void)scrollViewDidScroll:(UIScrollView *)scrollView{
    NSLog(@"scrollViewDidScroll");
}                                              // any offset changes
- (void)scrollViewDidZoom:(UIScrollView *)scrollView{
    NSLog(@"scrollViewDidZoom");
}

// called on start of dragging (may require some time and or distance to move)
- (void)scrollViewWillBeginDragging:(UIScrollView *)scrollView{
    NSLog(@"scrollViewWillBeginDragging");
}

- (void)scrollViewWillEndDragging:(UIScrollView *)scrollView withVelocity:(CGPoint)velocity targetContentOffset:(inout CGPoint *)targetContentOffset{
    NSLog(@"scrollViewWillEndDragging");
}

- (void)scrollViewWillBeginDecelerating:(UIScrollView *)scrollView{
    NSLog(@"scrollViewWillBeginDecelerating");
}

- (void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView{
    NSLog(@"scrollViewDidEndDecelerating");
}

1 个答案:

答案 0 :(得分:3)

scrollView.delegate = self;如果你是实用的话。 如果您的ScrollView位于XIB,然后按住Ctrl +拖动scrollViewFile's Owner,然后设置其代理人。