zoukankan      html  css  js  c++  java
  • iOS UIViewController use

    UIViewController use

    1 appdelegate.m  

      - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions

    {

        self.window = [[[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]] autorelease];

        // Override point for customization after application launch.

        self.viewController = [[[ViewController alloc] initWithNibName:@"ViewController" bundle:nil] autorelease];

        self.window.rootViewController = self.viewController;

        [self.window makeKeyAndVisible];

        return YES;

    }

    ViewController.h

      @interface ViewController : UIViewController 

    3 viewcontroller.m

    - (void)viewWillAppear:(BOOL)animated

    {

        [super viewWillAppear:animated];

        self.view.backgroundColor=[UIColor brownColor];

        //UIImage *img = [UIImage imageNamed:@"app_bg.png"];

        //self.view.backgroundColor=[UIColor colorWithPatternImage:img];

        if(!self.array)

        {

            self.array=[NSArray arrayWithObjects:@"aa",@"bb",@"cc", nil];

        }

        self.title=@"test";

        UILabel* label1=[[UILabel alloc] initWithFrame:CGRectMake(0, 0, 40, 40)];

        label1.backgroundColor=[UIColor blackColor];

        label1.text=[self.array objectAtIndex:0];

        [self.view addSubview:label1];

    } 

  • 相关阅读:
    jeecg接口开发及权限实现原理
    Jeecg中通过Spring_AOP+注解方式实现日志的管理
    Jeecg踩坑不完全指南
    在jeecg中如何配置多对一和多对多的关系
    一致性哈希算法
    到底什么是哈希Hash?
    如何正确实现 Java 中的 HashCode
    Hash和HashCode深入理解
    关于源码
    MySQL存储过程的创建及调用
  • 原文地址:https://www.cnblogs.com/csj007523/p/2642671.html
Copyright © 2011-2022 走看看