请问这样的功能该怎么实现?目前遇到的一个问题是崩溃,在xcode4.2 下。无缘无故的崩溃。例如切换的代码:secondViewController = [[SecondViewController alloc] initWithNibName:@"SecondView" bundle:nil];
[self.view addSubview:secondViewController.view];期望朋友门给点提示或者是例子那就更好了。

解决方案 »

  1.   


                    v0    = [[UIView   alloc] initWithFrame:CGRectMake(0, 0, 1024,768)];
    v1    = [[UIView   alloc] initWithFrame:CGRectMake(0, 0, 1024,768)];
    v2    = [[UIView   alloc] initWithFrame:CGRectMake(0, 0, 1024,768)];
    v3    = [[UIView   alloc] initWithFrame:CGRectMake(0, 0, 1024,768)];
    v4    = [[UIView   alloc] initWithFrame:CGRectMake(0, 0, 1024,768)];
    ⋯⋯
    -(void)setPage:(NSNotification *)pageIndex
    {
    for(UIView *views in self.view.subviews )
    {
    [views removeFromSuperview];
    }

    int i= [[pageIndex object] intValue];

    if(i==0){
    [self.view addSubview:v0];
    }
    else if (i == 1) {
    [self.view addSubview:v1];
    }
    else if (i == 2) {
    [self.view addSubview:v2];
    }
    else if (i == 3) {
    [self.view addSubview:v3];
    }
    else if (i == 4) {
    [self.view addSubview:v4];
    }
    else if (i == 5) {
    [self.view addSubview:v5];
    }
    else if (i == 6) {
    [self.view addSubview:v6];
    }
    ⋯⋯
    }//动画就自己弄吧  就一个大概的思路。
      

  2.   

    同意楼上哟。UIScrollView 的 pagingEnabled 然后按顺序addsubView就完事,不用自己处理任何事件
      

  3.   


    哎~知道什么叫任意切换吗?
    UIScrollView切换时内存使用量且不论,显示效果诸位试过吗?
    没脑子~
      

  4.   

    ybh37的好像是大神级人物,我在好多帖子里都看到过你,可以认识下吗?