控制上下滚动的按钮有问题。当我第一次单击向上按钮但第二次滚动视图不向上滚动时,它工作正常(向上滚动)。我做错了什么?这是代码:
创建滚动:
scrollView = [[UIScrollView alloc] initWithFrame:CGRectMake(38, 5, 90, 280)];
[scrollView setContentSize:CGSizeMake(90, 950)];
[scrollView setScrollEnabled: NO];
[imageView addSubview:scrollView];
[scrollView setShowsHorizontalScrollIndicator:NO];
[scrollView setShowsVerticalScrollIndicator:NO];
按钮动作:
-(IBAction)upButtonPress:(id)sender{
NSLog(@"UP");
[scrollView setContentOffset:CGPointMake(0, self.scrollView.frame.origin.y + 95)];
}
-(IBAction)downButtonPress:(id)sender{
NSLog(@"DOWN");
[scrollView setContentOffset:CGPointMake(0, self.scrollView.frame.origin.y - 95)];
}