朋友
我开发了一个滚动视图,设置了它的内容大小,并在滚动视图上设置了三个视图,它的滚动效果很好,我也希望它在分段控制点击时移动,但这不会发生,我的视图不在滚动上移动,有人能帮我解决这个问题吗?
发布于 2012-04-14 15:34:06
希望我能理解你的问题
尝尝这个
-(IBAction)SegmentControll:(Id)发送者
{
[myTableView removeFromSuperview];
if (SegmentControll.selectedSegmentIndex==0)
{
Yourscollview.scrollEnabled=NO;
}if (SegmentControll.selectedSegmentIndex==1)
{
Yourscollview.scrollEnabled=YES;
}}
如果需要更多的帮助,请找我。
发布于 2012-04-14 16:19:42
移动您的滚动视图与点击分段控制...在这里,我提供了样本code...you只需决定您想要移动滚动视图的分段索引...
if (SegmentControll.selectedSegmentIndex==0)
{
if ( self.scrollView.contentOffset.x <= self.scrollView.frame.size.width ) {
CGRect frame;
frame.origin.x = self.scrollView.contentOffset.x + self.scrollView.frame.size.width;
frame.origin.y = 0;
frame.size = self.scrollView.frame.size;
[self.scrollView scrollRectToVisible:frame animated:YES];
//pageControlBeingUsed = YES;
}
}
else if (SegmentControll.selectedSegmentIndex==1)
{
if ( self.scrollView.contentOffset.x >= self.scrollView.frame.size.width ) {
CGRect frame;
frame.origin.x = self.scrollView.contentOffset.x - self.scrollView.frame.size.width;
frame.origin.y = 0;
frame.size = self.scrollView.frame.size;
[self.scrollView scrollRectToVisible:frame animated:YES];
//pageControlBeingUsed = YES;
}
}我希望这能帮助你..。
https://stackoverflow.com/questions/10151705
复制相似问题