轉載 :http://www.cxy.me/doc/5558.htm架構iPhone
-
- CocoaFoundation(Mac OS X共通)
- UIKit
Android
MVCiPhone
-
- Model
- View
- UIView的父類
- InterfaceBuiler 設計的工具
- 設計的資訊,儲存到xib檔案(XML)
- Controller
- UIViewController
- UINavigationController
- UIImagePickerController
- UITabbarController
- UITableViewController
Android
-
- Model
- View
- android.view,android.widget
- 布局XML
- 設計的資訊儲存到xml檔案
- Controller
- Activity
- ListActivity
- MapActivity
- ExpandableListActivity
- TabActivity
View實裝方法
- Android和iPhone的View的実裝方法的比較
Controller使用方法
標籤設定文字列的時候
iPhone
@interfaceHogeViewController : UIViewController { UILabel *label;}@property (nonatomic, retain) IBOutlet UILabel *label;@end@implementation@synthesize label;/* Interface Builder- (void)loadView {}*/-(void)viewDidLoad { [superviewDidLoad]; label.text =@"Hello world!";}-(void)dealloc {// 記憶體的釋放
[label release]; [superdealloc];}@end
Android
publicclassHogeActivityextendsActivity {privateTextView label;protectedvoidonCreate(Bundle savedInstanceState) {super.onCreate(savedInstanceState); setContentView(R.layout.main); label = (TextView)findViewById(R.id.label); label.setText("Hello world!"); }}
事件iPhone
-
- Target Action
- Responder Chain
Android
事件的實裝
iPhone
-
- loadView
- viewDidLoad
- viewWillAppear
- viewDidAppear
- viewWillDisappear
- viewDidDisappear
Android
-
- onCreate
- onStart
- onResume
- onPause
- onStop
- onDestroy
記憶體方面的事件iPhone
Android