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

时间:2014-05-24 02:16:56   收藏:0   阅读:290

Hello world开始。

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

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

AppDelegate.h:

bubuko.com,布布扣
#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
bubuko.com,布布扣

 

AppDelegate.m:

bubuko.com,布布扣
#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
bubuko.com,布布扣

 

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

ios成长之每日一遍(day 1),布布扣,bubuko.com

评论(0
© 2014 mamicode.com 版权所有 京ICP备13008772号-2  联系我们:gaon5@hotmail.com
迷上了代码!