zoukankan      html  css  js  c++  java
  • 一个controller中加入另外一个controller的view 适用于segment的状况

    修正方案,之前的方案方案会导致队列不断增加,这边需要注意的是,当view为nil时 不会调用removeFormSuperView 所以这个时候不会出现异常。队列不断增加会导致内存溢出。

    • (void)clickToChose:(id)sender

    {

    UIButton *button = (UIButton *)sender;
    
    oneViewController *oneView = [self.storyboard instantiateViewControllerWithIdentifier:@"one"];
    
    twoViewController *twoView = [self.storyboard instantiateViewControllerWithIdentifier:@"two"];
    
    
    
    switch (button.tag) {
    
        case 1000:
    
            
    
            
    
            [self.subView addSubview:oneView.view];
    
            [currentView removeFromSuperview];
    
            currentView = oneView.view;
    
            
    
            break;
    
        case 1001:
    
            [self.subView addSubview:twoView.view];
    
            [currentView removeFromSuperview];
    
            currentView = twoView.view;
    
            
    
            break;
    
        case 1002:
    
            [self.subView addSubview:oneView.view];
    
            [currentView removeFromSuperview];
    
            currentView = oneView.view;
    
            
    
            break;
    
        case 1003:
    
            [self.subView addSubview:twoView.view];
    
            [currentView removeFromSuperview];
    
            currentView = twoView.view;
    
            
    
            break;
    
            
    
        default:
    
            break;
    
    }
    

    }

  • 相关阅读:
    GTD时间管理(1)---捕获搜集
    ios面试总结-
    Swift入门篇-结构体
    Swift入门篇-闭包和函数
    swift入门篇-函数
    Swift入门篇-集合
    Swift入门篇-循环语句
    Swift入门篇-基本类型(3)
    Swift入门篇-基本类型(2)
    Swift入门篇-基本类型(1)
  • 原文地址:https://www.cnblogs.com/cillyfly/p/3625130.html
Copyright © 2011-2022 走看看