IPhone Development Tips(1)Build the Environment

IPhone Development Tips(1)Build the Environment

1. Environment
The Mac OS X version is 10.6.7.

Visit this URL http://www.apple.com.cn/developer/ and download the iphone sdk with your developer id.

IPhone SDK:
Xcode is an IDE, base on GNU gcc and gdb.
Instruments, watch the memory and performance. It is base on SUN DTrace.
Dashcode
Simulator
IB(Interface Builder) build the user interface.

First of all, I am updating my mac os system. After that the system version is 10.6.8. And click update again, and update again.
Finally, I copy the update file 'Install Mac OS X Lion' from my collegue, double click and install it on my system.
The system is updated to 10.7.

Install xcode software, this is copied from my collegue too. The name is 'Install Xcode'.

The IPhone code is based on Objective-C 2.0.

2. Sample Application
create a new xcode project ----> IOS----> Application ----> Single View Application
Enter the
Product Name --> hello3
Company Identifer --> sillycat
Class Prefix ----> hello3
Device Family ----> IPhone
Use Storyboard ----> Checked
User Automatic Reference Counting ----> checked
Include Unit Tests ----> Not Checked

And click 'Next' ----> click 'Create' ----> Click 'Run', we can see the hello3 application with a white paper.

Find Out How an Application Starts Up
Most of the work is done by UIApplicationMain function in main.m. The main function in main.m calls the UIApplicationMain function within an autorelease pool.
main.m

The call to UIApplicationMain also scans the application’s Info.plist file. The Info.plist file is a property list that contains information about the application such as its name and icon.

HelloWorld-Info.plist

In this application, the storyboard file is named MainStoryboard.storyboard (note that the Info.plist file shows only the first part of this name). When the app starts, the MainStoryboard.storyboard file is loaded and the initial view controller is instantiated from it.

MainStoryboard.storyboard
Xcode opens the storyboard file in the editor area. (The area behind the storyboard objects—that is, the area that looks like graph paper—is called the canvas.)

A storyboard file contains scenes and segues. A scene represents a view controller, which manages one area of content, and a segue represents a transition between two scenes.

one scene and no segues in Single View template.

#1 A first responder placeholder object is a dynamic placeholder that represents the responder object that first receives events such as keyboard events, motion events.
#2 The hello3ViewController object
#3 A view

During setup, the application object performs the following tasks:
loads the main storyboard file ----> gets the window object from the app delegate ----> instantiates the storyboard's initial view controller and assigns it as the window object's root view controller

When the application object has completed these tasks, it sends its delegate an application:didFinishLaunchingWithOptions: message. This message gives the delegate an opportunity to perform other tasks, such as additional configuration, before the application is displayed.

Inspecting the View Controller and Its View
Use the Inspector to Examine the View Controller
When an app starts up, the main storyboard file is loaded and the initial view controller is instantiated.

click 'MainStoryboard.storyboard' ----> 'Hello3 View Controller' ----> 'Attribute Inspector'

we can see 'Is Initial View Controller' is checked.

Change the View's Background Color
click the 'View' behind the 'Hello3 View Controller' ----> In the View window, change the Background color

Configuring the View
we will add a button, a label, and a text field. Then, make connections between these elements and the view controller class so that the elements provide the behavior we want.

Add the User Interface Elements
drag the buttons and other objects from object library in right bottom.
Set some configuration to Text Field---->
Capitalization --->Words
Keyboard ---->Default
Return Key ----> Done

After that, we can take a look at the app we implemented. But there is no way to dismiss the keyboard after it appears.


references:
http://www.cocoachina.com/
http://www.cocoachina.com/newbie/index.html
http://developer.apple.com/
http://www.apple.com.cn/developer/
http://osxdaily.com/2011/07/20/upgrading-to-mac-os-x-10-7-lion/
http://www.apple.com.cn/developer/iphone/library/documentation/iPhone/Conceptual/iPhone101/Articles/02_CreatingProject.html
http://developer.apple.com/library/ios/#documentation/iphone/conceptual/iPhone101/Articles/00_Introduction.html#//apple_ref/doc/uid/TP40007514-CH1-SW1
http://www.techotopia.com/index.php/Creating_a_Simple_iOS_4_iPhone_App_(Xcode_4)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值