zoukankan      html  css  js  c++  java
  • 不使用nib 文件时,需要改变一个view 的大小时,需要为viewcontroller添加loadView方法

    - (void)loadView{
        self.view = [[UIView alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
        [self.view setBackgroundColor:[UIColor whiteColor]];
    }

     注意:不能将 loadView 方法中的代码写在  - (void)viewDidLoad ,一定要为viewController方法添加一个loadView方法。

    其他viewController 调用上述 viewController时,可以通过以下方法进行

    -(IBAction)searchButtonOnClicked:(id)sender
    {
        NSLog(@"开始查询");
        
    //    ResultVC *myResultVC = [[ResultVC alloc]initWithNibName:nil bundle:nil];
        ResultVC *myResultVC = [[ResultVC alloc]init];
        myResultVC.nsma_result = nsma_selectedSerachContent;
        self.resultVC = myResultVC;
        [self.view addSubview:self.resultVC.view];
    }
  • 相关阅读:
    外观模式
    建造者模式
    原型模式
    工厂模式
    单例模式
    设计模式入门
    SpringBoot-SpringMVC开发总结
    SpringBoot日志
    IDEA Basics
    Kafka基础学习
  • 原文地址:https://www.cnblogs.com/ygm900/p/3163466.html
Copyright © 2011-2022 走看看