Presentation is loading. Please wait.

Presentation is loading. Please wait.

UNIT-V APPLICATION DEVELOPMENT Three tier architecture - Model View Controller Architecture - Memory Management –Information Access Devices – PDAs and.

Similar presentations


Presentation on theme: "UNIT-V APPLICATION DEVELOPMENT Three tier architecture - Model View Controller Architecture - Memory Management –Information Access Devices – PDAs and."— Presentation transcript:

1 UNIT-V APPLICATION DEVELOPMENT Three tier architecture - Model View Controller Architecture - Memory Management –Information Access Devices – PDAs and Smart Phones – Smart Cards and Embedded Controls – J2ME – Programming for CLDC – GUI in MIDP – Application Development ON Android and iPhone IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 1

2 Three tier architecture All 3 layers are on the same machine All code and processing kept on a single machine Presentation, Logic, Data layers are tightly connected IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 2

3 Scalability: Single processor means hard to increase volume of processing Portability: Moving to a new machine may mean rewriting everything Maintenance: Changing one layer requires changing other layers IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 3

4 2-Tier Architecture Database runs on Server Separated from client Easy to switch to a different database Presentation and logic layers still tightly connected IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 4

5 Heavy load on server Potential congestion on network Presentation still tied to business logic 3-Tier Architecture Each layer can potentially run on a different machine Presentation, logic, data layers disconnected IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 5

6 The 3-Tier Architecture for Web Apps Presentation Layer Static or dynamically generated content rendered by the browser (front-end) Logic Layer A dynamic content processing and generation level application server, e.g., Java EE, ASP.NET, PHP, ColdFusion platform (middleware) Data Layer A database, comprising both data sets and the database management system or RDBMS software that manages and provides access to the data (back-end) IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 6

7 3-Tier Architecture Advantages Independence of Layers Easier to maintain Components are reusable Faster development (division of work) Web designer does presentation Software engineer does logic DB admin does data model IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 7

8 The Model-View-Controller Pattern IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 8

9 Model-View-Controller Architecture The MVC separates application data from the graphical presentation components and input-processing logic. MVC originally appeared in Smalltalk as a method for separating user interfaces from underlying application data Model – Contains application data – When the model changes, it notifies the view View – Generates a presentation of the data stored in the model – The view updates its presentation whenever the model changes Controller – Implements logic for processing user input – Use user provided input to modifies model IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 9

10 Model-view-controller architecture(diagram) IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 10

11 The MVC allows multiple Views and Controllers corresponding to a single Model in an application A developer can provide additional views and controllers for an application model without changing the existing components Java’s Swing components implements a variant of the MVC – Combines the view and controller into a single object, called a delegate IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 11

12 Delegate-model architecture – Variant of MVC – Combines the view and controller into a single object - delegate – The delegate provides both a graphical presentation of the model and an interface for modifying the model Example Every JButton has an associated ButtonModel. The JButton is the delegate. The ButtonModel maintains state information (button is pressed or enabled) and list of ActionListeners. The JButton provides a graphical presentation and modifies the ButtonModel’s state IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 12

13 Memory management Memory management is the act of managing computer memory. The essential requirement of memory management is to provide ways to dynamically allocate portions of memory to programs at their request, and free it for reuse when no longer needed. This is critical to any advanced computer system where more than a single process might be underway at any time. IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 13

14 Several methods have been devised that increase the effectiveness of memory management. Virtual memory systems separate the memory addresses used by a process from actual physical addresses, allowing separation of processes and increasing the effectively available amount of RAM using paging or swapping to secondary storage. The quality of the virtual memory manager can have an extensive effect on overall system performance. IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 14

15 Dynamic memory allocation Efficiency Implementations Fixed-size-blocks allocation Buddy blocks Systems with virtual memory Protection Sharing Physical organization IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 15

16 Information Access Devices A Tablet Computer that lacks a keyboard (also known as a non-convertible tablet) is shaped like slate or a paper notebook, features a touchscreen with a stylus and handwriting recognition software. Tablets may not be best suited for applications requiring a physical keyboard for typing, but are otherwise capable of carrying out most tasks that an ordinary laptop would be able to perform. A Personal Digital Assistant (PDA) is a small, usually pocket-sized, computer with limited functionality. It is intended to supplement and to synchronize with a desktop computer, giving access to contacts, address book, notes, e- mail and other features. An Ultra mobile PC is a full-featured, PDA-sized computer running a general-purpose operating system. A Smartphone has a wide range of features and installable applications. IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 16

17 Personal digital assistant(PDA’s) A personal digital assistant (PDA), also known as a palmtop computer, or personal data assistant It is a mobile device that functions as a personal information manager. PDAs are largely considered obsolete with the widespread adoption of smartphones. IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 17

18 Nearly all current PDAs have the ability to connect to the Internet. A PDA has an electronic visual display, enabling it to include a web browser, all current models also have audio capabilities enabling use as a portable media player, and also enabling most of them to be used as mobile phones. Most PDAs can access the Internet, intranets or extranets via Wi-Fi or Wireless Wide Area Networks. Most PDAs employ touchscreen technology. IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 18

19 The first PDA was released in 1984 by Psion, the Organizer II. Followed by Psion's Series 3, in 1991, which began to resemble the more familiar PDA style. It also had a full keyboard. The term PDA was first used on January 7, 1992 by Apple Computer CEO John Sculley at the Consumer Electronics Show in Las Vegas, Nevada, referring to the Apple Newton. IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 19

20 Typical features A typical PDA has a touchscreen for entering data, a memory card slot for data storage, Bluetooth and/or Wi-Fi. Some PDAs may not have a touch screen, using soft keys, a directional pad, and a numeric keypad or a thumb keyboard for input; this is typically seen on telephones that are incidentally PDAs. In order to have the functions expected of a PDA, a device's software typically includes an appointment calendar, a to-do list, an address book for contacts, a calculator, and some sort of memo (or "note") program. PDAs with wireless data connections also typically include an email client and a Web browser. IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 20

21 Smartphone A smartphone, or smart phone, is a mobile phone built on a mobile operating system, with more advanced computing capability and connectivity than a feature phone Smartphones combined the functions of a personal digital assistant (PDA), including email functionality, with a mobile phone. IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 21

22 Later models added the functionality of portable media players, low- end compact digital cameras, pocket video cameras, and GPS navigation units to form one multi-use device. Many modern smartphones also include high-resolution touchscreens and web browsers that display standard web pages as well as mobile-optimized sites. High-speed data access is provided by Wi-Fi, mobile broadband, NFC and Bluetooth. In recent years, the rapid development of mobile app markets and of mobile commerce have been drivers of smartphone adoption. IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 22

23 The mobile operating systems (OS) used by modern smartphones include Google's Android, Apple's iOS, Symbian, Blackberry Ltd's BlackBerry 10, Samsung's Bada, Microsoft's Windows Phone, Hewlett-Packard's webOS, embedded Linux distributions such as Maemo and MeeGo. IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 23

24 Such operating systems can be installed on many different phone models, and typically each device can receive multiple OS software updates over its lifetime. A few other upcoming operating systems are Mozilla's Firefox OS, Canonical Ltd.'s Ubuntu Phone, and Tizen. Worldwide sales of smartphones exceeded those of feature phones in early 2013. As of July 18, 2013, 90 percent of global handset sales are attributed to the purchase of Android and iPhone smartphones. IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 24

25 The first Li-Fi smartphone prototype will be presented at the Consumer Electronics Show in Las Vegas from January 7th-10th in 2014. The phone uses SunPartner's Wysips CONNECT, a technique that converts light waves into usable energy, making the phone capable of receiving and decoding signals without drawing on its battery. IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 25

26 Smart Cards and Embedded Controls A smart card, typically a type of chip card, is a plastic card that contains an embedded computer chip–either a memory or microprocessor type–that stores and transacts data. This data is usually associated with either value, information, or both and is stored and processed within the card's chip. The card data is transacted via a reader that is part of a computing system. IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 26

27 SMART…? Usage of smart cards In different applications which require strong security protection and authentication – Identification card – Medical card – Credit/debit bank card (as an electric wallet) All require sensitive data to be stored on the card, such as: – biometrics information – personal medical history – cryptographic keys for authentication – Logging on to networks Wirelessly: – Public transport payments (tickets) etc. IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 27

28 Physical Structure Made up of three elements 1.A physical card (plastic) 2.A printed circuit chip 3.An integrated circuit chip (microcontroller) (Chips are embedded on the card) Printed circuit conforms to ISO standard 7816/3 which provides five connection points for power and data – The printed circuit protects the circuit chip from mechanical stress and static electricity The capability of a smart card is defined by its integrated circuit chip. Chip made from silicon which is not flexible and particularly easy to break In general, the size, the thickness and bend requirements for the smart card are designed to protect the card from being spoiled physically IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 28

29 Java? – J2ME Java – “write once run anywhere” But: – Different devices have different requirements. – Those devices doesn’t have the same environment as regular computers (standard desktop), the constrains we have: Limited memory and processor. Small screen sizes. Alternative input methods. – One platform (solution) cannot address all the market segments (web server, video games etc.) – Users/developers want flexibility. They want to choose what they want to use and what they don’t. Sun decided to develop a special edition of Java – J2ME (Java 2 Micro Edition). IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 29

30 Java Editions The Java 2 Platform is split into three editions: – Java 2 Standard Edition (J2SE) - Desktop-based applications. – Java 2 Enterprise Edition (J2EE) - Server-based applications. – Java 2 Micro Edition (J2ME) – For handheld and embedded devices. Each edition provides a complete environment for running Java- based applications including the Java virtual machine (VM) and runtime classes. What separates one edition from another, then, is primarily the set of class libraries that each edition defines. you can think of J2ME as a subset of J2SE and J2SE as a subset of J2EE. IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 30

31 What will we know. IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 31

32 J2ME Core Concepts At the heart of Java 2 Micro Edition (J2ME) are three core concepts: configurations, profiles, and optional packages. You can't write a J2ME application without understanding these concepts, because they determine the features of Java that you can use, which application programming interfaces (APIs) are available, and how your applications are packaged. IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 32

33 J2ME Core Concepts Optional Packages Profile: – A collection of Java Classes selected from one or more Java core, extension or vertical APIs. Classes are chosen to provide a complete solution for a specific vertical market Configuration: – A subset of the Java core APIs and Java language functionality selected to provide a minimal Java platform for a set of vertical markets J2ME Profile J2ME Libraries Java Virtual Machine Profiles Configuration Host Operating System Java Language IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 33

34 What it all means There is no "J2ME application“: – Configuration, profile and optional packages should be chosen. A configuration is a complete Java runtime environment: – Java virtual machine (VM) to execute Java. – Set of core Java runtime classes – Interface to the underlying system IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 34

35 What it all means The profile adds classes to a configuration: – To fill in missing functionality – To support specific uses of a device The Optional Packages are set of APIs that support additional and common behaviors. – Examples of optional packages : Bluetooth Optional Package JDBC Optional Package IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 35

36 Configuration There are 2 basic configurations. The superset: – CDC (Connected Device Configuration): 2 MB or more memory for Java platform. 32-bit processor. High bandwidth network connection. full-featured Java 2 virtual machine (CVM). 17 packages. Use for devices like Palms. IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 36

37 Configuration The one we use: – CDLC (Connected Limited Device Configuration): 160 - 512 KB of total memory 16-bit or 32-bit processor Low power consumption and often operating with battery power Connectivity with limited bandwidth Selected classes from: – java.lang, java.io, java.util Limited VM (KVM) without: – Floating point types – Object finalization – JNI or reflection – Thread groups or daemon threads – User Class loaders IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 37

38 Handling I/O in CDC / CLDC The CLDC has defined a new set of APIs for I/O called the Generic Connection Framework. The GCF, part of the new javax.microedition.io package, defines interfaces for the different kinds of I/O that are possible. Since the CDC is a superset of the CLDC, it includes the GCF. CDC also requires GCF support for two specific connection types: files and datagrams since it includes the relevant classes from java.io and java.net packages. IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 38 Programming for CLDC(Connected Limited Device Configuration)

39 Configuration - What it all means CDC-based profiles make development simpler due to J2SE-like APIs, but don’t suit the low-end devices. CLDC-based profiles makes the development task harder, especially when trying to shrink the size of the application to run on many of the small devices. IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 39

40 Profile Several profiles in various stages of development: – Mobile Information Device Profile (MIDP) - CLDC-based, used for running applications on cellphones and interactive pagers with small screens, wireless HTTP connectivity, and limited memory. – Personal Digital Assistant Profile (PDAP) – CLDC-based, extends MIDP with additional classes and features for more powerful handheld devices. – Foundation Profile (FP) – CDC-based, extends the CDC with additional J2SE classes. – Personal Basis Profile (PBP) - extends the FP with lightweight (AWT-derived) user interface classes and a new application model. – Personal Profile extends the PBP with applet support and heavyweight UI classes. IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 40

41 Profile The CLDC-profile used today: MIDP (Mobile Information Device Profile) The MIDP defines a platform for dynamically and securely deploying optimized, graphical, networked applications. The MIDP specification was defined through the Java Community Process (JCP) by players like: Motorola, Nokia, Ericsson, Research in Motion, and Symbian. IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 41

42 MIDP – MID Profile MIDP is targeted at a class of devices known as mobile information devices (MIDs). Minimal characteristics of MIDs: – Enough memory to run MIDP applications – Display of at least 96 X 56 pixels, either monochrome or color – A keypad, keyboard, or touch screen – Two-way wireless networking capability IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 42

43 GUI in MIDP MIDP - Specification There are two versions of the MIDP: – MIDP 1.0 - is the original specification, provides core application functionality required by mobile applications, including basic user interface and network security – MIDP 2.0 - is a revised version of the MIDP 1.0. Have new features include an enhanced user interface, multimedia and game functionality, more extensive connectivity, over-the-air provisioning, and end-to-end security. IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 43

44 MIDlets – The heart of J2ME… MIDP does not run in the “regular” Java fashion. using: Main(), System.exit(). Instead, we use MIDlet aplications - which are subclasses of: javax.microedition.midlet.MIDlet that is defined by MIDP. The MIDlet class allows the application management software to: – control the MIDlet – be able to retrieve properties from the application descriptor – notify and request state changes IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 44

45 MIDlets – The heart of J2ME… The extending class is the main class of the application. The MIDlet class defines abstract methods that the main class implements (for example: startApp(), destroyApp(), notifyDestroyed()). IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 45

46 MIDlet Suite One or more MIDlets are packaged together into a MIDlet suite, composed of: – JAR (Java archive) file - The JAR file contains Java classes for each MIDlet in the suite and Java classes that are shared between MIDlets. The JAR file also contains resource files used by the MIDlets and a manifest file. – JAD (Java Application Descriptor) file - This file contains a predefined set of attributes that allows the device application management software to identify, retrieve, and install the MIDlets Eventually the JAR / JAD files are upload to the machine in order to run the application. IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 46

47 Configuration + Profile When the Java 2 Platform, Micro Edition (J2ME) was first introduced, only one configuration, the Connected Limited Device Configuration (CLDC), and one profile, the Mobile Information Device Profile (MIDP) had been defined as formal specifications. Today, there are nearly forty J2ME-related specifications at various stages in the JCP, and many of these specifications define optional packages instead of configurations or profiles. IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 47

48 So what is an optional package? An optional package is also a set of APIs, but unlike a profile, it does not define a complete application environment. An optional package is always used in conjunction with a configuration or a profile. It extends the runtime environment to support device capabilities that are not universal enough to be defined as part of a profile or that need to be shared by different profiles. Examples: – RMI Optional Package (Remote Method Invocation). – Wireless Messaging API. – Mobile Media API IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 48

49 Extenders There are some companies that created different suite for J2ME. Those companies are “competing partners” with Sun (- they buy the KVM from Sun). Example: – Nokia’s Developer's Suite: provides tools for creating application classes and packages, signing the application, and deploying it to a device. It is also an essential tool for managing, configuring, and running emulators for various Nokia Platform. IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 49

50 Application Development on Android and the iPhone Android Need Java 5.0+ Easiest to use Eclipse 3.3.1+ Download SDK starter pack from developer.android.com and invoke SDK setup program Install Eclipse plugin Help, Install New Software Android Development Tools Tell Eclipse where Android is located Windows, Preferences, Android IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 50

51 Hello Android Eclipse File, New, Project, Android, Android Project Create Android Virtual Device (AVD) Window, Android SDK, AVD Manager Run (on emulator) To run on phone enable USB debugging Settings, Applications, USB Debugging Install USB driver (Windows only) IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 51

52 Android App Framework Created by default src -- Hello.java -- main Activity res, drawable -- icon.png – app’s icon res, values -- strings.xml – constants res, layout – main.xml -- screen layout AndroidManifest.xml – table of contents gen – R.java – references, never touch it IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 52

53 Rock Paper Scissors Two activities – Rsp and Res Layout – TextView over nested layout Hook up buttons Use an Intent to go from one to the other Result activity – text, text, button Result text enhanced Can configure layouts by dragging widgets and entering properties IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 53

54 Ball Game Touch ball to score, after 10 ball shrinks and goes faster Easy, medium, hard choices Uses a Java view not XML Uses the onTouchEvent handler Use the onDraw method to draw on a canvas IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 54

55 OpenGL (from Hello Android) Rotating cube Uses OpenGL ES (embedded systems) Draws cube from vertices Uses GLRenderer onSurfaceCreated -- set properties onSurfaceChanged – update view onDrawFrame – draw the scene IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 55

56 Browser View (from Hello Android) An EditText and Button above WebView WebView uses loadUrl method to display web page Documentation – developer.android.com IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 56

57 iPhone Needs Intel Mac, OS X 10.5.4+ Download SDK and register (free) developer.apple.com/iphone $99 to deploy to iPhone or iPod Uses Objective-C Launch XCode Examples from iPhone SDK Development IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 57

58 Hello iPhone File, New Project in XCode Choose View-based Application HelloViewController class and HelloViewController.xib (nib), freeze-dried GUI HelloAppDelegate manages application Use Interface Builder to add Label and configure color and size in Attributes inspector IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 58

59 Hello User Allow user to enter a name IBOutlet – reference from code to nib object, e.g. label, text field IBAction – method nib’s objects can call, e.g. button press handler In Interface Builder, connect outlets to code, connect action Touch Up Inside event to handler method, sayHello Implement the sayHello handler method IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 59

60 Movie - MVC Create Movie class (the model) Labels with movie info, Edit button MovieEditorViewController for edit view with Done button to return to main screen Send message in Edit button to start movie controller Send message in Done button to return to MovieViewController IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 60

61 Movie Table UITableView, UITableViewDataSource protocol provides number of rows, add, delete, etc., UITableViewDelegate to handle tapping to select a row Uses Navigation-based Application UINavigationController UINavigationBar (with Edit and Add buttons) RootViewContoller (with UITableView) UINavigationItem IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 61

62 Movie Table -2 UINavigationController maintains navigation state as a stack of view controllers. Uses an array to hold table data. Initial array hard- coded. Changes are not saved. IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 62

63 Conference -- Core Data Built on SQLite Managed Object Context – row data turned into objects Managed Object Model – like schema Persistence Store Coordinator – connects to the database Double-click on Conference.xcdatamodel to get screen to configure tables IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 63

64 Core Data - 2 Create Managed Object Class to represent the model Conference has tracks with trackAbstract, name, sessions Edit and Add buttons configured in code in viewDidLoad method rather than in Interface Builder NSFetchedResultsController – adaptor between CoreData and table view IFETCE/M.E (CSE) /I YEAR/I SEM/ NE7002/MPC/UNIT-V/PPT/VERSION1.1 64


Download ppt "UNIT-V APPLICATION DEVELOPMENT Three tier architecture - Model View Controller Architecture - Memory Management –Information Access Devices – PDAs and."

Similar presentations


Ads by Google