Iphone 使用UIScrollview访问4个不同的视图

Iphone 使用UIScrollview访问4个不同的视图,iphone,uiscrollview,views,uiswipegesturerecognizer,Iphone,Uiscrollview,Views,Uiswipegesturerecognizer,这看起来应该很直接,但我真的被卡住了。我基本上想启动这个应用程序,然后它进入中心视图,在那里用户可以上下左右滑动以访问四个不同的视图。这张照片大致概括了这一点。我会制作图片中的文字“向上滑动以查看1”“向下滑动以查看…”按钮,这些按钮也可以实现与滑动相同的功能,但我不想要求太多,因此如果有人能帮助我并告诉我如何编程,我将非常感谢 我能够让它成为一个巨大的视图,但我意识到我希望它能跳转到每一个不同的视图,而不是滚动到一半。当我试着制作cgrect帧时,让它保持有序是非常混乱的 这里,我为您提供示例

这看起来应该很直接,但我真的被卡住了。我基本上想启动这个应用程序,然后它进入中心视图,在那里用户可以上下左右滑动以访问四个不同的视图。这张照片大致概括了这一点。我会制作图片中的文字“向上滑动以查看1”“向下滑动以查看…”按钮,这些按钮也可以实现与滑动相同的功能,但我不想要求太多,因此如果有人能帮助我并告诉我如何编程,我将非常感谢


我能够让它成为一个巨大的视图,但我意识到我希望它能跳转到每一个不同的视图,而不是滚动到一半。当我试着制作cgrect帧时,让它保持有序是非常混乱的

这里,我为您提供示例代码。我只为两个视图编写代码。您只需根据滚动确定视图位置

-(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];
}

}
-(无效)ScrollViewDiEndDecelling:(UIScrollView*)scrollView
{

如果(scroll.contentOffset.y>480&&scroll.contentOffset.x,我将为您提供示例代码。我只为两个视图编写代码。您只需要根据scroll确定视图位置

-(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];
}

}
-(无效)ScrollViewDiEndDecelling:(UIScrollView*)scrollView
{

如果(scroll.contentOffset.y>480&&scroll.contentOffset.xb,但我认为不需要滚动视图。您可以使用手势。但我认为不需要滚动视图。您可以使用手势。