• ios成长之每日一遍(day 1)


    Hello world开始。

    这里不讨论如何创建项目导入项目。由于趁上班时间打酱油所以也不谈细节, 只谈具体项目的实现与关键流程的解析, 只供本人实际程况使用。不喜请移驾。

    首先来谈谈 AppDelegate.h与AppDelegate.m 文件

    AppDelegate.h:

    #import <UIKit/UIKit.h>
    
    @class BIDViewController;    // 声明引用的文件
    
    @interface BIDAppDelegate : UIResponder <UIApplicationDelegate>   // 实现UIApplicationDelegate协议中的方法,用于处理UIApplication接收的事件     
    
    @property (strong, nonatomic) UIWindow *window;    // UIView的子类, 是所有UIView的根,管理和协调的应用程序的显示
    
    @property (strong, nonatomic) BIDViewController *viewController;
    
    @end

    AppDelegate.m:

    #import "BIDAppDelegate.h"
    
    #import "BIDViewController.h"
    
    @implementation BIDAppDelegate
    
    - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
    {
        self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];    // 初始化UIWindow
        // Override point for customization after application launch.
        self.viewController = [[BIDViewController alloc] initWithNibName:@"BIDViewController" bundle:nil];    // 初始化BIDViewController并且指定controller的xib文件, xib文件就是布局文件
        self.window.rootViewController = self.viewController;    // 指定window的根视图控制器
        [self.window makeKeyAndVisible];    // 让window显示在屏幕上
        return YES;
    }
    
    - (void)applicationWillResignActive:(UIApplication *)application
    {
        // Sent when the application is about to move from active to inactive state. This can occur for certain types of temporary interruptions (such as an incoming phone call or SMS message) or when the user quits the application and it begins the transition to the background state.
        // Use this method to pause ongoing tasks, disable timers, and throttle down OpenGL ES frame rates. Games should use this method to pause the game.
    }
    
    - (void)applicationDidEnterBackground:(UIApplication *)application
    {
        // Use this method to release shared resources, save user data, invalidate timers, and store enough application state information to restore your application to its current state in case it is terminated later. 
        // If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.
    }
    
    - (void)applicationWillEnterForeground:(UIApplication *)application
    {
        // Called as part of the transition from the background to the inactive state; here you can undo many of the changes made on entering the background.
    }
    
    - (void)applicationDidBecomeActive:(UIApplication *)application
    {
        // Restart any tasks that were paused (or not yet started) while the application was inactive. If the application was previously in the background, optionally refresh the user interface.
    }
    
    - (void)applicationWillTerminate:(UIApplication *)application
    {
        // Called when the application is about to terminate. Save data if appropriate. See also applicationDidEnterBackground:.
    }
    
    @end

    由于是hello world, BIDViewController也没有什么东西, 只是一个简单的文本, 因此就不挪来说了, 至此第一篇ios的开端已经结束。

  • 相关阅读:
    linux 鼠标中键粘帖功能?!!
    mysql 学习笔记(一)
    log4j的使用 与 父接口 slf4j 门面模式(外观模式)
    web.xml 配置 文章汇总
    2019.08.04 新建随笔
    spring-事务的七个传播行为,最近想出去面试,了解一下框架知识
    20190710 tomcat下的项目导入到eclipse中
    20190709 关于web.xml中webAppRootKey的解释
    20160624 策略模式
    20190616 IDEA-每次修改JS文件都需要重启Idea才能生效解决方法
  • 原文地址:https://www.cnblogs.com/lee0oo0/p/3736848.html
Copyright © 2020-2023  润新知