自拍偷在线精品自拍偷,亚洲欧美中文日韩v在线观看不卡

詳解iPhone開發(fā)入門教程 新手必看

移動(dòng)開發(fā) iOS
本文介紹的是詳解iPhone開發(fā)入門教程 新手必看,作為新手,你不得不看,很詳細(xì)的從思路開始幫你學(xué)習(xí)iphone開發(fā)基礎(chǔ),來看內(nèi)容。

詳解iPhone開發(fā)入門教程 新手必看是本文要介紹的內(nèi)容,本文是在壇子上看到的一篇關(guān)于iphone開發(fā)基礎(chǔ)教程的,主要講解iphone開發(fā)的思想和一些簡單的實(shí)現(xiàn)。來看詳細(xì)內(nèi)容。先來推薦一篇 iPhone開發(fā)入門教程 圖解,可以作為參考!

思路:

(1)Interface Builder制作界面

(2)頭文件中增加Outlet和事件響應(yīng)函數(shù)

(3)建立界面與代碼的關(guān)聯(lián)

(4)添加實(shí)際代碼(初始化、按鍵響應(yīng)等)

效果: (第二張圖單擊可放大)

詳解iPhone開發(fā)入門教程 新手必看 

詳解iPhone開發(fā)入門教程 新手必看

代碼:

Java代碼 

  1.  
  2. //     
  3. //  QuizAppDelegate.h     
  4. //  Quiz     
  5. //     
  6. //  Created by bruce.lin on 6/21/11.     
  7. //  Copyright 2011 __MyCompanyName__. All rights reserved.     
  8. //     
  9.     
  10. #import <UIKit/UIKit.h>     
  11.     
  12. @interface QuizAppDelegate : NSObject <UIApplicationDelegate> {     
  13.     
  14.     int currentQuestionIndex;     
  15.          
  16.     NSMutableArray *questions;     
  17.     NSMutableArray *answers;     
  18.          
  19.     IBOutlet UILabel *questionField;     
  20.     IBOutlet UILabel *answerField;     
  21.          
  22.     UIWindow *window;     
  23. }     
  24.     
  25. @property (nonatomic, retain) IBOutlet UIWindow *window;     
  26.     
  27. -(IBAction) showQuestion:(id)sender;     
  28. -(IBAction) showAnswer:(id)sender;     
  29.     
  30. @end    
  31.     
  32. //     
  33. //  QuizAppDelegate.m     
  34. //  Quiz     
  35. //     
  36. //  Created by bruce.lin on 6/21/11.     
  37. //  Copyright 2011 __MyCompanyName__. All rights reserved.     
  38. //     
  39.     
  40. #import "QuizAppDelegate.h"    
  41.     
  42. @implementation QuizAppDelegate     
  43.     
  44.     
  45. @synthesize window=_window;     
  46.     
  47.     
  48. -(id)init     
  49. {     
  50.     [super init];     
  51.     questions=[[NSMutableArray alloc] init];     
  52.     answers=[[NSMutableArray alloc] init];     
  53.     
  54.     [questions addObject:@"iPhone多少米?"];     
  55.     [answers addObject:@"為啥告訴你"];     
  56.          
  57.     [questions addObject:@"路邊野花不要采"];     
  58.     [answers addObject:@"一只紅杏出墻來"];     
  59.          
  60.     currentQuestionIndex=0;     
  61.          
  62.     return self;     
  63. }     
  64.     
  65.     
  66. -(IBAction) showQuestion:(id)sender     
  67. {     
  68.     currentQuestionIndex++;     
  69.          
  70.     if(currentQuestionIndex >= [questions count])     
  71.     {     
  72.         currentQuestionIndex=0;     
  73.     }     
  74.          
  75.     [questionField setText:[questions objectAtIndex:currentQuestionIndex]];     
  76.          
  77.     NSLog(@"Current question is: %@",[questions objectAtIndex:currentQuestionIndex]);     
  78.          
  79.     [answerField setText:@"?"];     
  80. }     
  81.     
  82. -(IBAction) showAnswer:(id)sender     
  83. {     
  84.     [answerField setText:[answers objectAtIndex:currentQuestionIndex]];     
  85. }     
  86.     
  87.     
  88. - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions     
  89. {     
  90.     // Override point for customization after application launch.     
  91.     [self.window makeKeyAndVisible];     
  92.     return YES;     
  93. }     
  94.     
  95. - (void)applicationWillResignActive:(UIApplication *)application     
  96. {     
  97.     /*    
  98.      Sent when the application is about to move from active to inactive state. 
  99. This can occur for certain types of temporary interruptions 
  100. (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.    
  101.      Use this method to pause ongoing tasks, disable timers, 
  102. and throttle down OpenGL ES frame rates. Games should use this method to pause the game.    
  103.      */    
  104. }     
  105.     
  106. - (void)applicationDidEnterBackground:(UIApplication *)application     
  107. {     
  108.     /*    
  109.      Use this method to release shared resources, save user data, invalidate timers,
  110.  and store enough application state information to restore your application to its current state in case it is terminated later.     
  111.      If your application supports background execution, this method is called instead of applicationWillTerminate: when the user quits.    
  112.      */    
  113. }     
  114.     
  115. - (void)applicationWillEnterForeground:(UIApplication *)application     
  116. {     
  117.     /*    
  118.      Called as part of the transition from the background to the inactive state;
  119.  here you can undo many of the changes made on entering the background.    
  120.      */    
  121. }     
  122.     
  123. - (void)applicationDidBecomeActive:(UIApplication *)application     
  124. {     
  125.     /*    
  126.      Restart any tasks that were paused (or not yet started) while the application was inactive. 
  127. If the application was previously in the background, optionally refresh the user interface.    
  128.      */    
  129. }     
  130.     
  131. - (void)applicationWillTerminate:(UIApplication *)application     
  132. {     
  133.     /*    
  134.      Called when the application is about to terminate.    
  135.      Save data if appropriate.    
  136.      See also applicationDidEnterBackground:.    
  137.      */    
  138. }     
  139.     
  140. - (void)dealloc     
  141. {     
  142.     [_window release];     
  143.     [super dealloc];     
  144. }     
  145. @end  

小結(jié):詳解iPhone開發(fā)入門教程 新手必看的內(nèi)容介紹完了,通過本文介紹的iphone開發(fā)基礎(chǔ),是不是學(xué)習(xí)到了一些內(nèi)容,那么希望本文對你有所幫助!

責(zé)任編輯:zhaolei 來源: ITEYE論壇
相關(guān)推薦

2011-07-21 10:29:18

iPhone 開發(fā)

2011-09-07 11:13:27

無線路由器無線路由器設(shè)置

2010-07-27 15:53:15

2011-07-18 14:15:55

iPhone iPad GIS

2011-06-16 09:53:25

Qt QML 教程

2011-06-16 09:40:53

QML 教程

2011-06-16 09:28:14

Qt QML 教程

2010-08-02 09:36:22

Flex

2011-06-27 14:56:46

Qt Designer

2011-05-31 16:47:47

SEO

2010-06-13 09:45:35

Widget開發(fā)

2009-06-02 14:46:26

Hibernate關(guān)系映射教程

2011-07-04 17:26:00

Qt SQLite

2013-09-18 14:46:32

StormStorm集群

2023-11-29 07:30:08

Python用戶界面

2011-08-22 12:01:38

iPhone開發(fā)文件

2011-06-23 10:12:57

SEO網(wǎng)站建設(shè)

2011-07-11 09:58:52

2009-07-08 15:12:48

Java Servle

2014-05-26 15:35:55

Web組件Web Compone
點(diǎn)贊
收藏

51CTO技術(shù)棧公眾號