Handling Basic InteractionEng. Abdulrazzaq Alnajjar   iabdulrazzaq@outlook.com   1
The Model-View-Controller Paradigm• Model-View-Controller (MVC) is a very logical  way of dividing the code that makes up ...
Looking at the View Controller• The Button Fun folder should contain four  source code files (the ones that end in .h or ....
Looking at the View Controller• The controller class called BIDViewController is  responsible for managing our application...
Outlets and Actions• A controller class can refer to objects in a nib  file by using a special kind of property called  an...
Outlets• Outlets are special Objective-C class  properties that are declared using the  keyword IBOutlet.Eng. Abdulrazzaq ...
Actions• Actions are methods that are declared with a  special return type, IBAction, which tells  Interface Builder that ...
User InterfaceEng. Abdulrazzaq Alnajjar      iabdulrazzaq@outlook.com   8
Buttons and Action Method1)      Object library2)      Round Rect Button.(Drag)3)      View (Drop)4)      Edit the button’...
Buttons and Action Method6) Control-dragging to source codeEng. Abdulrazzaq Alnajjar   iabdulrazzaq@outlook.com   10
Buttons and Action Method7) Connection: Action, Name: buttonPressed,   Press connect.Eng. Abdulrazzaq Alnajjar   iabdulraz...
Buttons and Action Method8) Header file should now look like this:Eng. Abdulrazzaq Alnajjar   iabdulrazzaq@outlook.com   12
Buttons and Action Method9) Impelementation file added a method stubEng. Abdulrazzaq Alnajjar   iabdulrazzaq@outlook.com  ...
Label and Outlet• Adding outlet to labelEng. Abdulrazzaq Alnajjar       iabdulrazzaq@outlook.com   14
Label and Outlet• header file after adding outletEng. Abdulrazzaq Alnajjar       iabdulrazzaq@outlook.com   15
Action Method                                                                  Take the title of the button               ...
Application Delegate• Objects that take responsibility for doing  certain tasks on behalf of another object.• Every iOS ap...
AppDelegate.h FileEng. Abdulrazzaq Alnajjar        iabdulrazzaq@outlook.com   18
AppDelegate.m FileEng. Abdulrazzaq Alnajjar        iabdulrazzaq@outlook.com   19
AppDelegate.m FileEng. Abdulrazzaq Alnajjar        iabdulrazzaq@outlook.com   20
AppDelegate.m FileEng. Abdulrazzaq Alnajjar        iabdulrazzaq@outlook.com   21
Upcoming SlideShare
Loading in …5
×

Beginning iOS6 Development CH03 Handlling Basic Interaction

316 views

Published on

Beginning iOS6 Development CH03 Handlling Basic Interaction

Published in: Education
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
316
On SlideShare
0
From Embeds
0
Number of Embeds
1
Actions
Shares
0
Downloads
11
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Beginning iOS6 Development CH03 Handlling Basic Interaction

  1. 1. Handling Basic InteractionEng. Abdulrazzaq Alnajjar iabdulrazzaq@outlook.com 1
  2. 2. The Model-View-Controller Paradigm• Model-View-Controller (MVC) is a very logical way of dividing the code that makes up a GUI- based application.• The MVC pattern divides all functionality into three distinct categories: – Model: The classes that hold your application’s data. – View: Made up of the windows, controls, and other elements that the user can see and interact with. – Controller: The code that binds together the model and view. It contains the application logic that decides how to handle the user’s inputs.Eng. Abdulrazzaq Alnajjar iabdulrazzaq@outlook.com 2
  3. 3. Looking at the View Controller• The Button Fun folder should contain four source code files (the ones that end in .h or .m) and a single nib file.Eng. Abdulrazzaq Alnajjar iabdulrazzaq@outlook.com 3
  4. 4. Looking at the View Controller• The controller class called BIDViewController is responsible for managing our application’s view.• contents of the BIDViewController header file:Eng. Abdulrazzaq Alnajjar iabdulrazzaq@outlook.com 4
  5. 5. Outlets and Actions• A controller class can refer to objects in a nib file by using a special kind of property called an outlet.• interface objects in nib file can be set up to trigger special methods in controller class. These special methods are known as action methods.Eng. Abdulrazzaq Alnajjar iabdulrazzaq@outlook.com 5
  6. 6. Outlets• Outlets are special Objective-C class properties that are declared using the keyword IBOutlet.Eng. Abdulrazzaq Alnajjar iabdulrazzaq@outlook.com 6
  7. 7. Actions• Actions are methods that are declared with a special return type, IBAction, which tells Interface Builder that this method can be triggered by a control in a nib file.Eng. Abdulrazzaq Alnajjar iabdulrazzaq@outlook.com 7
  8. 8. User InterfaceEng. Abdulrazzaq Alnajjar iabdulrazzaq@outlook.com 8
  9. 9. Buttons and Action Method1) Object library2) Round Rect Button.(Drag)3) View (Drop)4) Edit the button’s title.5) Show the Assistant Editor.Eng. Abdulrazzaq Alnajjar iabdulrazzaq@outlook.com 9
  10. 10. Buttons and Action Method6) Control-dragging to source codeEng. Abdulrazzaq Alnajjar iabdulrazzaq@outlook.com 10
  11. 11. Buttons and Action Method7) Connection: Action, Name: buttonPressed, Press connect.Eng. Abdulrazzaq Alnajjar iabdulrazzaq@outlook.com 11
  12. 12. Buttons and Action Method8) Header file should now look like this:Eng. Abdulrazzaq Alnajjar iabdulrazzaq@outlook.com 12
  13. 13. Buttons and Action Method9) Impelementation file added a method stubEng. Abdulrazzaq Alnajjar iabdulrazzaq@outlook.com 13
  14. 14. Label and Outlet• Adding outlet to labelEng. Abdulrazzaq Alnajjar iabdulrazzaq@outlook.com 14
  15. 15. Label and Outlet• header file after adding outletEng. Abdulrazzaq Alnajjar iabdulrazzaq@outlook.com 15
  16. 16. Action Method Take the title of the button Put the title in a string Equal the string to the labelEng. Abdulrazzaq Alnajjar iabdulrazzaq@outlook.com 16
  17. 17. Application Delegate• Objects that take responsibility for doing certain tasks on behalf of another object.• Every iOS application has one, and only one.Eng. Abdulrazzaq Alnajjar iabdulrazzaq@outlook.com 17
  18. 18. AppDelegate.h FileEng. Abdulrazzaq Alnajjar iabdulrazzaq@outlook.com 18
  19. 19. AppDelegate.m FileEng. Abdulrazzaq Alnajjar iabdulrazzaq@outlook.com 19
  20. 20. AppDelegate.m FileEng. Abdulrazzaq Alnajjar iabdulrazzaq@outlook.com 20
  21. 21. AppDelegate.m FileEng. Abdulrazzaq Alnajjar iabdulrazzaq@outlook.com 21

×