Iphone 使用Xib滚动和更改视图

Iphone 使用Xib滚动和更改视图,iphone,uiscrollview,paging,Iphone,Uiscrollview,Paging,我想为两个视图实现分页概念,我实现了它,它工作得很好,但是在给定的视图中,第一个视图应该有两个视图,导航栏中有两个按钮,如果我选择一个按钮,它将显示一个视图,第二个按钮应该显示第二个视图,我使用Xib添加滚动视图,并在其中添加视图 现在的问题是,在firstView中选择第二个按钮时,我没有获得secondview 请引导我解决这个问题 我正在使用此代码获取scrollview中的视图 NSArray *views = [NSArray arrayWithObjects:maleC

我想为两个视图实现分页概念,我实现了它,它工作得很好,但是在给定的视图中,第一个视图应该有两个视图,导航栏中有两个按钮,如果我选择一个按钮,它将显示一个视图,第二个按钮应该显示第二个视图,我使用Xib添加滚动视图,并在其中添加视图

现在的问题是,在firstView中选择第二个按钮时,我没有获得secondview

请引导我解决这个问题

我正在使用此代码获取scrollview中的视图

       NSArray *views = [NSArray arrayWithObjects:maleCircleView,femaleCircleView, nil];
        for (int i = 0; i < views.count; i++) 
        {
            UIView *subview = [views objectAtIndex:i];
            CGRect frame;
            frame.origin.x = self.scrollView.frame.size.width * i+10;
            frame.origin.y = subview.frame.origin.y-30;
            frame.size = self.scrollView.frame.size;

            [titleLabel setHidden:YES];
            subview.frame = frame;
            if(i==0)
            {
                UIView *femaleView = [[UIView alloc]initWithFrame:CGRectMake(0, 0, 320, 460)];
                [femaleView setBackgroundColor:[UIColor redColor]];
                [femaleView setTag:subview.tag+11];
                UIImageView *sample = [[UIImageView alloc]initWithImage:[UIImage imageNamed:@"save.png"]];
                sample.frame = CGRectMake(250, 50, 50, 50);
                [femaleView addSubview:sample];
                NSLog(@"femaleView:%@",femaleCircleView);
                [self.scrollView addSubview:femaleView];
                [femaleView addSubview:maleCircleView];
//               [femaleView setHidden:YES];
            }
            NSLog(@"subview:%@",subview);
            [self.scrollView addSubview:femaleCircleView];

        }
NSArray*视图=[NSArray阵列及其对象:maleCircleView,femaleCircleView,nil];
对于(int i=0;i
使用
将subviewTofront
方法

 [self.view bringSubviewToFront:yourSelectedView];
我想这对你会有帮助的