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的开端已经结束。

时间: 2024-08-28 15:04:11

ios成长之每日一遍(day 1)的相关文章

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

toolBar上的View Switcher BIDAppDelegate.h #import <UIKit/UIKit.h> @class BIDSwitchViewController; @interface BIDAppDelegate : UIResponder <UIApplicationDelegate> @property (strong, nonatomic) UIWindow *window; @property (strong, nonatomic) BIDSw

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

接着下来简单说说Label(相当于android的textview)和button的使用, 由于都是与上篇的AppDelegate一致, 所以这一篇就说说ViewController与xib的使用呗. BIDViewController.h #import <UIKit/UIKit.h> @interface BIDViewController : UIViewController // 类的开始 @property (weak, nonatomic) IBOutlet UILabel *st

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

iOS 屏幕方向那点事儿http://zhenby.com/blog/2013/08/20/talk-ios-orientation/ 针对当前的屏幕方向进行对应的代码布局 BIDViewController.m #import "BIDViewController.h" @interface BIDViewController () @end @implementation BIDViewController - (void)viewDidLoad { [super viewDidL

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

这几天都有一些任务要跟, 把ios的学习拉后, 看看要抓紧咯, 看看轮到的学习的是UITableView. BIDViewController.h #import <UIKit/UIKit.h> @interface BIDViewController : UIViewController <UITableViewDataSource, UITableViewDelegate> @property (copy, nonatomic) NSArray *computers; @end

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

今天到UITabBarController 结合 UIPickView, 这里一共有5个实现, 由浅到易. 其实在IB上面使用UITabBarController很简单, 就像平常拖控件一样拖到界面上面, 然后把Tab Bar Item拉到UITabBarController就可以增加底下的tab, 再分别指定底下tab就可以关联到对应的ViewController. BIDAppDelegate.h #import <UIKit/UIKit.h> @interface BIDAppDeleg

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

今天, 主要讲四种常见的问题, 废话不多说了, 直接开始. 自动布局:这个我发现有一篇文章写得非常好, 直接表明出地http://www.cocoachina.com/applenews/devnews/2013/1203/7462.html          part onehttp://www.raywenderlich.com/50319/beginning-auto-layout-tutorial-in-ios-7-part-2      part two

来自我的破船大大的博客,记录他的iOS成长之路,与君同勉!

注1:这篇文章是我的iOS成长之路系列文章中的第三篇文章,第一篇文章:iOS成长之路-1-入门,第二篇文章:iOS成长之路-2-我的第一个iOS Demo. 通过两周时间来学习iOS,我慢慢的叩开了iOS开发的大门,接下来就是一个积累的过程,我主要经历了如下几个过程: 饱览群书 跟着项目一起成长 与同行交流 做一些分享 饱览群书 在初期,我认为多看书对于个人提升有很大的帮助,从某方面来说,这主要扩展了个人对iOS开发的理解广度(初期,先不要急于往最深处研究),接着把书上的讲解与动手编程结合起来,

IOS成长中-C语言-数据类型(第一天)

定义常量分三部分:数据类型 变量名 = 初值    定义整型变量       变量名的命名规则:        1.变量名只能由数字,字母,下划线组成,并且数字不能开头.        2.不能和系统关键字重名.        3.具有自解释性,见名知意.        4.变量名不能重复.        5.变量名由多个单词组成时,除了首个单词首字母小写外,其他的单词首字母都要大写     int a = 10;     float b = 1.0;//用于注释一行.     char a =

IOS成长之路-去掉屏幕键盘的方法

//定义两个文本框 UITextField *textName; UITextField *textSummary; //点击return 按钮 去掉 -(BOOL)textFieldShouldReturn:(UITextField *)textField { [textField resignFirstResponder]; return YES; } //点击屏幕空白处去掉键盘 - (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent