在Xcode4.5中开发第一个iOS6.0应用(HelloWorld)
在Xcode4.5中开发第一个应用程序还是比较简单的,下面我就通过自己的学习已经通过自己的总结来告诉大家如何创建自己的第一个iOS6.0的应用程序。
第一步:我们打开Xcode程序创建一个HelloWorld
![](https://img-my.csdn.net/uploads/201301/06/1357468010_8603.png)
![](https://img-my.csdn.net/uploads/201301/06/1357468193_3815.png)
![](https://img-my.csdn.net/uploads/201301/06/1357468219_2859.png)
![](https://img-my.csdn.net/uploads/201301/06/1357468280_8532.png)
通过上面的图片截图的过程我们的第一个应用程序就已经创建成功了。
第二步:设计软件的界面
编辑MainStoryboard.storyboard
![](https://img-my.csdn.net/uploads/201301/06/1357469055_6005.png)
![](https://img-my.csdn.net/uploads/201301/06/1357469112_5723.png)
第三步:开始正式编写代码
首先打开ViewController.h文件编辑文件中的内容
#import <UIKit/UIKit.h>
@interface ViewController : UIViewController{
IBOutlet UITextField *textField;
}
@property(nonatomic,retain) UITextField *textField;
-(IBAction)onClickButton:(id)sender;
@end
再打开ViewController.m文件编辑文件中内容
#import "ViewController.h"
@interface ViewController ()
@end
@implementation ViewController
@synthesize textField;
-(IBAction)onClickButton:(id)sender{
textField.text = @"HELLO SHUAIYIN";
}
- (void)viewDidLoad
{
[super viewDidLoad];
// Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning
{
[super didReceiveMemoryWarning];
// Dispose of any resources that can be recreated.
}
- (void)dealloc
{
[textField release];
[super dealloc];
}
@end
第四步:连线
![](https://img-my.csdn.net/uploads/201301/07/1357560771_1810.png)
![](https://img-my.csdn.net/uploads/201301/07/1357560786_1880.png)
![](https://img-my.csdn.net/uploads/201301/07/1357560799_6577.png)
![](https://img-my.csdn.net/uploads/201301/07/1357560813_8515.png)
这样一来所有的东西都已经全部都做完了,最后运行结果就是我们想要的结果
成功显示我们需要的内容在文本框中显示
![](https://img-my.csdn.net/uploads/201301/07/1357560828_1430.png)