【发布时间】:2013-01-31 10:56:51
【问题描述】:
我的 scrollView 为 280(w) x 350(h),content view 为 840(w) x 405(h)。
我使用segmented control 在视图之间切换,如下所示:
- (IBAction)segmentedClicked:(UISegmentedControl *)sender
{
CGFloat x = sender.selectedSegmentIndex * self.personalDetailsScrollView.frame.size.width;
CGPoint point = CGPointMake(x, 0);
[self.personalDetailsScrollView setContentOffset:point animated:YES];
}
我想禁用常规水平滚动,因此只有分段按钮会水平滚动视图。垂直滚动应保持活动状态。
尝试使用 -(void)scrollViewDidScroll 和此处提供的解决方案:(How to lock the horizontal scrolling of a scrollView in iOS) 但由于某种原因它对我不起作用。
【问题讨论】:
-
尝试根据宽度大小改变滚动视图内容大小
-
也许这会有所帮助? stackoverflow.com/questions/1062693/…
-
只需设置它的
contentSizeWidth0 .....!!
标签: ios uiscrollview scroll