`
sillycat
  • 浏览: 2552521 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

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)



分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics