iPhone开发入门2-创建View Based程序
2009-05-24 17:13
316 查看
iPhone programming - Hello world program -II(View Based)
In my previous application just we created the application with default template generated by the xcode.if not done with that just have a look that first application and then go through this.
You will learn how to:
Create a New view-Based Application
Learn About the Default Files
This tutorial assumes that you have already installed the iPhone SDK. If you are unsure how to do this, click and follow the steps.
Creating a View-Based Application
Open Up Xcode
You will be doing all of your development in Xcode. Then close the Welcome window (if it shows up)
Start a new iPhone OS Project
Click Xcode > New Project and a window should pop up like this:
Make sure Application is selected under iPhone OS and then select View-Based Application. Click Choose… It will ask you to name your project. Type in “HW_view_iappdevs” and let’s get started.
Learn About the Default Files
What is all this stuff?
There are quite a few files that get added to your project. At first glance, this looks kind of intimidating. Don’t worry, we only need to edit one of them. Here is a quick explanation of the different files. You don’t have to read this part but having this many files is what confused me the most when I started developing for the iPhone.
In my previous session we learned about some default files, here i am skipping those .
For window based application we will get only two files ,those are
AppDelegate.h
AppDelegate.m
But here we will get four files , those are
Prefixes for this files depends on your project name you mentioned while creating.
HW_View_iappdevsAppDelegate.h
HW_View_iappdevsAppDelegate.m
HW_View_iappdevsViewController.h
HW_View_iappdevsViewController.m
We already learned about AppDelegate files, but i’ll expalin here again.
HW_View_iappdevsAppDelegate.h - This is a header file that contains all of our definitions for variables that we will be using. It’s very similar to a header file in C or C++;
HW_View_iappdevsAppDelegate.m - All of the magic starts here. Consider this file our starting point for execution. The main.m file invokes this object.
HW_View_iappdevsViewController.h,HW_View_iappdevsViewController.m- hese are files for a view controller that gets added to our main window. Basically, Apple has already created a simple interface when you clicked on view based application.
Info.plist - This contains various meta information about your program. You won’t really need to edit this until you are ready to start testing on the iPhone
main.m - Like most programming language, this file contains our main function. This is where execution begins. The main function basically instantiates our object and starts the program. You shouldn’t need to edit this file.
MainWindow.xib - This contains the visual information of our main window. If you double click on it, it will open in a program called “Interface Builder”. We will get to this a little later. Just on thing to note is this file does not contain any code.
HW_View_iappdevsViewController.xib - This contains the visual information of our view controller view. If you double click on it, it will open in a program called “Interface Builder”. We will get to this a little later. Just on thing to note is this file does not contain any code.
Now, all of these files together create a basic program. Go ahead and click on the Build and Go button at the top of Xcode. Make sure the drop-down on the top left says Simulator | Debug, this tells Xcode that we are testing on the iPhone simulator.
You will see the iPhone simulator start and your program will launch. It’s not very interesting at the moment.
Now just open HW_View_iappdevsViewController.xib as shown below (Double click on that )
Then it will be opened in interface builder.
In interface builder you may find four different windows.
1) HW_View_iappdevsViewController.xib
2) Window
3) Inspector window
4) Library window.
If You not find these don’t worry.
Just click on Tools in interface builder menu bar
Tools—->library
Tools—->inspector
In this way you can open them
<
Drag and drop this label on window, then double click on dropped label and change the text as “Basic Hello World”. And save it then build and go
相关文章推荐
- iPhone开发入门1 - 创建一个window-Based程序
- iPhone开发入门3 - 创建一个UITable View程序
- iPhone开发入门4 - 创建一个UITable View程序,不使用Interface Builder
- iPhone开发之文件创建、删除、读取、写入
- CodeWarrior 开发环境快速入门-工程创建
- VS2010/MFC编程入门之五十二(Ribbon界面开发:创建Ribbon样式的应用程序框架)
- iPhone开发入门(5)---iPhone编程初步
- iOS开发入门教程 iPhone开发相关学习资料
- 新手对于iPhone开发环境等入门问题解答汇总(2010-07-26更新)
- 超级详细的Cocos2D Iphone游戏开发入门文章
- 《iOS5编程揭秘-iPhone与iPad应用开发入门》
- F#入门-第五章 F#开发实例-第一节 创建文字编辑器(一)
- day1:Android Wear开发入门--创建手表模拟器及在as平台上创建Android Wear工程
- 《iOS6编程揭秘-iPhone与iPad应用开发入门(第二版)(配光盘)》
- 我的iphone开发学习笔记(一)创建view_based_application
- iPhone入门开发系列2备忘录APP学习02
- iPhone开发入门(3)--- 从C/C++语言到Objective-C语言
- C# iphone开发 MontTouch 使用代码创建UIWindow
- iPhone开发入门教程
- 【PHP入门篇】 6.PHP开发工具之Zend Studio安装与创建--慕课网【学习总结】