lesson404_modelviewcontroller

上传人:w****i 文档编号:106685406 上传时间:2019-10-15 格式:PDF 页数:59 大小:2.20MB
返回 下载 相关 举报
lesson404_modelviewcontroller_第1页
第1页 / 共59页
lesson404_modelviewcontroller_第2页
第2页 / 共59页
lesson404_modelviewcontroller_第3页
第3页 / 共59页
lesson404_modelviewcontroller_第4页
第4页 / 共59页
lesson404_modelviewcontroller_第5页
第5页 / 共59页
点击查看更多>>
资源描述

《lesson404_modelviewcontroller》由会员分享,可在线阅读,更多相关《lesson404_modelviewcontroller(59页珍藏版)》请在金锄头文库上搜索。

1、CS193P - Lecture 4 iPhone Application Development Building an Application Model, View, Controller Nib Files Controls and Target-Action 1Friday, January 15, 2010 Announcements Friday sections Friday, 4-5: 260-113 Invites to Developer Program will go out this weekend Sign up and get your certificate w

2、hen you get it Start making apps that will run on Hardware! Waiting for a couple students to reply about P/NC spots If we dont hear back today, were giving them away 2Friday, January 15, 2010 Todays Topics Application Lifecycle Model, View, Controller design Interface Builder and Nib Files Controls

3、and Target-Action HelloPoly demo 3Friday, January 15, 2010 Review 4Friday, January 15, 2010 Memory Management Alloc/Init -alloc assigns memory; -init sets up the object Override -init, not -alloc Retain/Release Increment and decrement retainCount When retainCount is 0, object is deallocated Dont cal

4、l -dealloc! Autorelease Object is released when run loop completes 5Friday, January 15, 2010 Setters, Getters, and Properties Setters and Getters have a standard format: - (int)age; - (void)setAge:(int)age; Properties allow access to setters and getters through dot syntax: property age; int theAge =

5、 person.age; person.age = 21; 6Friday, January 15, 2010 Building an Application 7Friday, January 15, 2010 Anatomy of an Application Compiled code Your code Frameworks Nib files UI elements and other objects Details about object relationships Resources (images, sounds, strings, etc) Info.plist file (

6、application configuration) 8Friday, January 15, 2010 App Lifecycle Launch app Load main nib Wait for event Handle event Exit app App initialized 9Friday, January 15, 2010 UIKit Framework Provides standard interface elements UIKit and you Dont fight the frameworks Understand the designs and how you f

7、it into them 10Friday, January 15, 2010 UIKit Framework Starts your application Every application has a single instance of UIApplication Singleton design pattern interface UIApplication + (UIApplication *)sharedApplication end Orchestrates the lifecycle of an application Dispatches events Manages st

8、atus bar, application icon badge Rarely subclassed Uses delegation instead 11Friday, January 15, 2010 Delegation Control passed to delegate objects to perform application- specific behavior Avoids need to subclass complex objects Many UIKit classes use delegates UIApplication UITableView UITextField

9、 12Friday, January 15, 2010 Xcode project templates have one set up by default Object you provide that participates in application lifecycle Can implement various methods which UIApplication will call Examples: UIApplicationDelegate 13Friday, January 15, 2010 Xcode project templates have one set up

10、by default Object you provide that participates in application lifecycle Can implement various methods which UIApplication will call Examples: - (void)applicationDidFinishLaunching:(UIApplication *)application; - (void)applicationWillTerminate:(UIApplication *)application; UIApplicationDelegate 13Fr

11、iday, January 15, 2010 Xcode project templates have one set up by default Object you provide that participates in application lifecycle Can implement various methods which UIApplication will call Examples: - (void)applicationWillResignActive:(UIApplication *)application; - (BOOL)application:(UIAppli

12、cation *)application handleOpenURL:(NSURL *)url; - (void)applicationDidFinishLaunching:(UIApplication *)application; - (void)applicationWillTerminate:(UIApplication *)application; UIApplicationDelegate 13Friday, January 15, 2010 Xcode project templates have one set up by default Object you provide t

13、hat participates in application lifecycle Can implement various methods which UIApplication will call Examples: - (void)applicationDidReceiveMemoryWarning:(UIApplication *)application; - (void)applicationWillResignActive:(UIApplication *)application; - (BOOL)application:(UIApplication *)application

14、handleOpenURL:(NSURL *)url; - (void)applicationDidFinishLaunching:(UIApplication *)application; - (void)applicationWillTerminate:(UIApplication *)application; UIApplicationDelegate 13Friday, January 15, 2010 Info.plist file Property List (often XML), describing your application Icon appearance Statu

15、s bar style (default, black, hidden) Orientation Uses Wifi networking System Requirements Can edit most properties in Xcode Project Edit Active Target “Foo” menu item On the properties tab 14Friday, January 15, 2010 Model, View, Controller If you take nothing else away from this class. 15Friday, Jan

16、uary 15, 2010 Model, View, Controller ModelView Controller 16Friday, January 15, 2010 Model Manages the app data and state Not concerned with UI or presentation Often persists somewhere Same model should be reusable, unchanged in different interfaces 17Friday, January 15, 2010 View Present the Model to the user in an appropriate interface Allows user to manipulate data Does not store any data (except to c

展开阅读全文
相关资源
正为您匹配相似的精品文档
相关搜索

最新文档


当前位置:首页 > 高等教育 > 大学课件

电脑版 |金锄头文库版权所有
经营许可证:蜀ICP备13022795号 | 川公网安备 51140202000112号