这看起来应该很直接,但我真的被卡住了。我基本上想启动应用程序,它进入中心视图,在那里用户可以向下向左或向右滑动来访问四种不同的视图。这张图片很好地总结了这一点。我将使图片中的文字“向上滑动查看1”“向下滑动查看.....”按钮也实现了同样的事情,但我不想要求太多,所以如果有人可以帮助我,并告诉我如何编程我正在寻找什么,我将非常感谢。

我能够让它成为一个巨大的视图,但我意识到我希望它跳到每一个不同的视图,而不是滚动到一半。当我尝试制作cgrect框架的时候,让它保持有序是非常令人困惑的。
发布于 2012-04-12 12:10:36
在这里,我提供了示例代码。我只需要编写两个views.You的代码,只需要根据滚动确定视图的位置。
-(void)scrollViewDidEndDecelerating:(UIScrollView *)scrollView
{
if(scroll.contentOffset.y> 480 && scroll.contentOffset.x<320)
{
//where next view is you view which you need to display according your requirements.
next *pushnext = [[next alloc]initWithNibName:@"next" bundle:nil];
[self.view addSubview:pushnext.view];
CGRect frame = pushnext.view.frame;
frame.origin.x = 10;
pushnext.view.frame = frame;
[pushnext release];
}
else if(scroll.contentOffset.y<480 && scroll.contentOffset.x>320)
{
//where next view is you view which you need to display according your requirements.
next *pushnext = [[next alloc]initWithNibName:@"next" bundle:nil];
[self.view addSubview:pushnext.view];
CGRect frame = pushnext.view.frame;
frame.origin.x = 10;
pushnext.view.frame = frame;
[pushnext release];
}
}我希望这能对你有所帮助。
https://stackoverflow.com/questions/10116381
复制相似问题