SlideShare una empresa de Scribd logo
1 de 45
Building User Interfaces
                    for iPhone Applications 101

                            John Kennedy - February 2009




Friday, February 20, 2009
Your tools: Xcode and Interface
                   Builder, and the Cocoa Touch framework.

Friday, February 20, 2009
Xcode: the IDE that includes source code
                            editor, tools, documentation and the front
                            end for the compiler i.e. with Xcode you can
                            enter, build and debug your application.

                            Interface Builder: an editor program for
                            dragging controls into your application’s
                            views and editing them visually.

                            Cocoa Touch: a framework of code for you to
                            use. Cocoa Touch contains controls and other
                            useful stuff for your iPhone applications.




Friday, February 20, 2009
The Cocoa Touch framework provides a
                            code library called UIKit for
                            creating iPhone-friendly controls.

                            Controls can be created
                            programmatically, but..

                            The Interface Builder tool makes
                            almost all of the process ‘drag and
                            drop’, and is the recommended
                            approach whenever possible.


Friday, February 20, 2009
UIViewController is the UIKit class
                            that provides the most fundamental
                            support for all iPhone ‘views’.

                            UIViewController, or its subclasses,
                            can manage (amongst others) tab bars,
                            navigation controls, and will even
                            rotate the display for you
                            automatically.




Friday, February 20, 2009
You could create your controls in your
                            UIViewController subclass
                            programmatically, by implementing the
                            loadView method.

                            Or you could use Interface Builder to
                            create a NIB file that contains all the
                            details of your view’s controls.

                            That’s all a NIB file is: a way of
                            storing a user interface. We’ll do it
                            that way.


Friday, February 20, 2009
When you consider how your application works,
                   it will probably have multiple views: for
                   example; one that displays groups, and one
                   that displays a list of names.
Friday, February 20, 2009
When you consider how your application works,
                   it will probably have multiple views: for
                   example; one that displays groups, and one
                   that displays a list of names.
Friday, February 20, 2009
Remember that each view is a class,
                            and so contains all the code that is
                            required to do what it needs to do:
                            for example, the class might contain
                            code that creates a list of names and
                            let the user select one.

                            Your application works by switching
                            between these different views.




Friday, February 20, 2009
How you switch between these views is
                            up to you, and the design of your
                            application.

                            It is important to spend time in
                            advance thinking about how your user
                            will switch between views.




Friday, February 20, 2009
Sketch your design out on paper
                            first, to make sure the ‘flow’ makes
                            sense.

                            Think about dividing information
                            between views. Will all your settings
                            be in one view? How many views are
                            needed?




Friday, February 20, 2009
Sketch your design out on paper
                            first, to make sure the ‘flow’ makes
                            sense.

                            Think about dividing information
                            between views. Will all your settings
                            be in one view? How many views are
                            needed?




Friday, February 20, 2009
A Tab Bar control is one way the user
                   could switch between your
                   application’s views.


Friday, February 20, 2009
A Tab Bar control is one way the user
                   could switch between your
                   application’s views.


Friday, February 20, 2009
Other common design patterns include
                   ‘drilling down’ from one view to
                   another.

Friday, February 20, 2009
Other common design patterns include
                   ‘drilling down’ from one view to
                   another.

Friday, February 20, 2009
The UINavigationController handles
                            this type of display for you, by
                            maintaining a stack of views and
                            providing navigation.




Friday, February 20, 2009
So what does each view look like,
                            from the point of view of you, the
                            programmer?

                            Each views will be encapsulated in
                            separate ‘chunks’ within your
                            application.




Friday, February 20, 2009
Here’s what each view involves:




Friday, February 20, 2009
Here’s what each view involves:

                                 Created with Interface Builder, the NIB file
                        NIB
      1.                         contains the controls, buttons, and other elements
                       File      that you have visually designed.

                                 A class (comprised of a .m file, and a .h file)
                            .m
      2.                         which is a subclass of UIViewController. Xcode will
                            .h   quickly help you create these source files.


                                                             Class




                                                              NIB



Friday, February 20, 2009
The important part!



                             NIB               .m
                            File               .h




                   You must introduce the NIB to the code
                   so they know about each other.

Friday, February 20, 2009
The important part!



                             NIB               .m
                            File               .h




                   You must introduce the NIB to the code
                   so they know about each other.

Friday, February 20, 2009
Here’s a step-by-step guide to how you
                            create a new view (both source code and
                            NIB) and wire them together.. watch
                            closely.. there is nothing up my sleeve..




Friday, February 20, 2009
1.0 Creating the source code.




            Select ‘Classes’ and Add -> New File...

Friday, February 20, 2009
1.1 Creating the source code.




                      Select UIViewController Class from
                              Cocoa Touch Classes
Friday, February 20, 2009
1.2 Creating the source code.




              Give it a name. I like to use the form
               XXXViewController. You don’t have to.
Friday, February 20, 2009
1.3 Creating the source code.




              There you go: your .h and you .m file,
            describing a subclass of UIViewController.
Friday, February 20, 2009
2.0 Create the NIB file part.




            This time select Resources as the folder, and
                          Add -> New File.
Friday, February 20, 2009
2.1 Create the NIB file part.




                             Use a View.XIB template.
                (Note: XIB is the new, improved version of NIB. We just keep
             calling them NIB files for old time’s sake and to confuse noobs.)
Friday, February 20, 2009
2.2 Create the NIB file part.




              Pick a name that will remind you which
            UIViewController class is associated with.
Friday, February 20, 2009
2.3 Create the NIB file part.




    Enjoy your new NIB file as it opens in Interface Builder.
     The blank View panel is where you can drag and drop controls.

Friday, February 20, 2009
2.4 Create the NIB file part.




              Drag some controls onto your View from
                           the Library.
Friday, February 20, 2009
3.0 Connect the NIB to the Class.




             Select File’s Owner, and make sure its class is set
               to be the ViewController class you just created.

Friday, February 20, 2009
3.1 Connect the NIB to the Class.




                    Connect the View to File’s Owner.
            (Option-Click on Files’s Owner and drag to View)
Friday, February 20, 2009
And that’s that.




Friday, February 20, 2009
But how do you make the views, you
                            know, actually visible?




Friday, February 20, 2009
When your application launches, the
                            default view (MainWindow.xib) will be
                            displayed.




Friday, February 20, 2009
When your application launches, the
                            default view (MainWindow.xib) will be
                            displayed.




                                       This is the easiest way,
                                      and it means you can write
                                           a simple one-view
                                        application in about 60
                                                seconds!



Friday, February 20, 2009
Other controls (such as Tab Bar
                            controls) can link to the NIB files,
                            thus causing them to appear.




Friday, February 20, 2009
Other controls (such as Tab Bar
                            controls) can link to the NIB files,
                            thus causing them to appear.




                       This isn’t that
                      hard either: you
                   just need to remember
                       to wire them up
                        properly from
                     Interface Builder.


Friday, February 20, 2009
You can create them programmatically
                            from within your application.




Friday, February 20, 2009
You can create them programmatically
                            from within your application.




                                        It turns out that only
                                         takes a few lines of
                                      Objective-C to open a View
                                        from a NIB and make it
                                               visible!



Friday, February 20, 2009
For example, this code creates a new
                      view and uses a Navigation Controller
                      to make it slide smoothly onto the
                      screen.



Friday, February 20, 2009
See? It’s not as scary as you might
                            think to create views and display them.

                            For more information, there are several
                            good 3rd party books including my
                            favourite “iPhone SDK Development” from
                            Pragmatic Programmers.

                            Don’t forget: Apple has some
                            surprisingly good documentation on its
                            iPhone Developer site.



Friday, February 20, 2009
The End

                            Please let me know of errors and
                            omissions: john_kenn@mac.com




Friday, February 20, 2009

Más contenido relacionado

Último

PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxMarlene Maheu
 
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...Nguyen Thanh Tu Collection
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjMohammed Sikander
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptxPoojaSen20
 
Dementia (Alzheimer & vasular dementia).
Dementia (Alzheimer & vasular dementia).Dementia (Alzheimer & vasular dementia).
Dementia (Alzheimer & vasular dementia).Mohamed Rizk Khodair
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSean M. Fox
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文中 央社
 
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhĐề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhleson0603
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽中 央社
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....Ritu480198
 
How to Analyse Profit of a Sales Order in Odoo 17
How to Analyse Profit of a Sales Order in Odoo 17How to Analyse Profit of a Sales Order in Odoo 17
How to Analyse Profit of a Sales Order in Odoo 17Celine George
 
The basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptxThe basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptxheathfieldcps1
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...Nguyen Thanh Tu Collection
 
Chapter 7 Pharmacosy Traditional System of Medicine & Ayurvedic Preparations ...
Chapter 7 Pharmacosy Traditional System of Medicine & Ayurvedic Preparations ...Chapter 7 Pharmacosy Traditional System of Medicine & Ayurvedic Preparations ...
Chapter 7 Pharmacosy Traditional System of Medicine & Ayurvedic Preparations ...Sumit Tiwari
 
Capitol Tech Univ Doctoral Presentation -May 2024
Capitol Tech Univ Doctoral Presentation -May 2024Capitol Tech Univ Doctoral Presentation -May 2024
Capitol Tech Univ Doctoral Presentation -May 2024CapitolTechU
 
How to Manage Closest Location in Odoo 17 Inventory
How to Manage Closest Location in Odoo 17 InventoryHow to Manage Closest Location in Odoo 17 Inventory
How to Manage Closest Location in Odoo 17 InventoryCeline George
 
Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...
Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...
Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...Denish Jangid
 
Features of Video Calls in the Discuss Module in Odoo 17
Features of Video Calls in the Discuss Module in Odoo 17Features of Video Calls in the Discuss Module in Odoo 17
Features of Video Calls in the Discuss Module in Odoo 17Celine George
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxneillewis46
 

Último (20)

PSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptxPSYPACT- Practicing Over State Lines May 2024.pptx
PSYPACT- Practicing Over State Lines May 2024.pptx
 
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
BỘ LUYỆN NGHE TIẾNG ANH 8 GLOBAL SUCCESS CẢ NĂM (GỒM 12 UNITS, MỖI UNIT GỒM 3...
 
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjjStl Algorithms in C++ jjjjjjjjjjjjjjjjjj
Stl Algorithms in C++ jjjjjjjjjjjjjjjjjj
 
ANTI PARKISON DRUGS.pptx
ANTI         PARKISON          DRUGS.pptxANTI         PARKISON          DRUGS.pptx
ANTI PARKISON DRUGS.pptx
 
Dementia (Alzheimer & vasular dementia).
Dementia (Alzheimer & vasular dementia).Dementia (Alzheimer & vasular dementia).
Dementia (Alzheimer & vasular dementia).
 
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading RoomSternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
Sternal Fractures & Dislocations - EMGuidewire Radiology Reading Room
 
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文會考英文
 
Mattingly "AI and Prompt Design: LLMs with Text Classification and Open Source"
Mattingly "AI and Prompt Design: LLMs with Text Classification and Open Source"Mattingly "AI and Prompt Design: LLMs with Text Classification and Open Source"
Mattingly "AI and Prompt Design: LLMs with Text Classification and Open Source"
 
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinhĐề tieng anh thpt 2024 danh cho cac ban hoc sinh
Đề tieng anh thpt 2024 danh cho cac ban hoc sinh
 
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽會考英聽
 
diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....diagnosting testing bsc 2nd sem.pptx....
diagnosting testing bsc 2nd sem.pptx....
 
How to Analyse Profit of a Sales Order in Odoo 17
How to Analyse Profit of a Sales Order in Odoo 17How to Analyse Profit of a Sales Order in Odoo 17
How to Analyse Profit of a Sales Order in Odoo 17
 
The basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptxThe basics of sentences session 4pptx.pptx
The basics of sentences session 4pptx.pptx
 
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
24 ĐỀ THAM KHẢO KÌ THI TUYỂN SINH VÀO LỚP 10 MÔN TIẾNG ANH SỞ GIÁO DỤC HẢI DƯ...
 
Chapter 7 Pharmacosy Traditional System of Medicine & Ayurvedic Preparations ...
Chapter 7 Pharmacosy Traditional System of Medicine & Ayurvedic Preparations ...Chapter 7 Pharmacosy Traditional System of Medicine & Ayurvedic Preparations ...
Chapter 7 Pharmacosy Traditional System of Medicine & Ayurvedic Preparations ...
 
Capitol Tech Univ Doctoral Presentation -May 2024
Capitol Tech Univ Doctoral Presentation -May 2024Capitol Tech Univ Doctoral Presentation -May 2024
Capitol Tech Univ Doctoral Presentation -May 2024
 
How to Manage Closest Location in Odoo 17 Inventory
How to Manage Closest Location in Odoo 17 InventoryHow to Manage Closest Location in Odoo 17 Inventory
How to Manage Closest Location in Odoo 17 Inventory
 
Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...
Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...
Basic Civil Engineering notes on Transportation Engineering, Modes of Transpo...
 
Features of Video Calls in the Discuss Module in Odoo 17
Features of Video Calls in the Discuss Module in Odoo 17Features of Video Calls in the Discuss Module in Odoo 17
Features of Video Calls in the Discuss Module in Odoo 17
 
Graduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptxGraduate Outcomes Presentation Slides - English (v3).pptx
Graduate Outcomes Presentation Slides - English (v3).pptx
 

Destacado

AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfmarketingartwork
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024Neil Kimberley
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)contently
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024Albert Qian
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsKurio // The Social Media Age(ncy)
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Search Engine Journal
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summarySpeakerHub
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next Tessa Mero
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentLily Ray
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best PracticesVit Horky
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project managementMindGenius
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...RachelPearson36
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Applitools
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at WorkGetSmarter
 

Destacado (20)

AI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdfAI Trends in Creative Operations 2024 by Artwork Flow.pdf
AI Trends in Creative Operations 2024 by Artwork Flow.pdf
 
Skeleton Culture Code
Skeleton Culture CodeSkeleton Culture Code
Skeleton Culture Code
 
PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024PEPSICO Presentation to CAGNY Conference Feb 2024
PEPSICO Presentation to CAGNY Conference Feb 2024
 
Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)Content Methodology: A Best Practices Report (Webinar)
Content Methodology: A Best Practices Report (Webinar)
 
How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024How to Prepare For a Successful Job Search for 2024
How to Prepare For a Successful Job Search for 2024
 
Social Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie InsightsSocial Media Marketing Trends 2024 // The Global Indie Insights
Social Media Marketing Trends 2024 // The Global Indie Insights
 
Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024Trends In Paid Search: Navigating The Digital Landscape In 2024
Trends In Paid Search: Navigating The Digital Landscape In 2024
 
5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary5 Public speaking tips from TED - Visualized summary
5 Public speaking tips from TED - Visualized summary
 
ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd ChatGPT and the Future of Work - Clark Boyd
ChatGPT and the Future of Work - Clark Boyd
 
Getting into the tech field. what next
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
 
Google's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search IntentGoogle's Just Not That Into You: Understanding Core Updates & Search Intent
Google's Just Not That Into You: Understanding Core Updates & Search Intent
 
How to have difficult conversations
How to have difficult conversations How to have difficult conversations
How to have difficult conversations
 
Introduction to Data Science
Introduction to Data ScienceIntroduction to Data Science
Introduction to Data Science
 
Time Management & Productivity - Best Practices
Time Management & Productivity -  Best PracticesTime Management & Productivity -  Best Practices
Time Management & Productivity - Best Practices
 
The six step guide to practical project management
The six step guide to practical project managementThe six step guide to practical project management
The six step guide to practical project management
 
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
Beginners Guide to TikTok for Search - Rachel Pearson - We are Tilt __ Bright...
 
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
Unlocking the Power of ChatGPT and AI in Testing - A Real-World Look, present...
 
12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work12 Ways to Increase Your Influence at Work
12 Ways to Increase Your Influence at Work
 
ChatGPT webinar slides
ChatGPT webinar slidesChatGPT webinar slides
ChatGPT webinar slides
 
More than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike RoutesMore than Just Lines on a Map: Best Practices for U.S Bike Routes
More than Just Lines on a Map: Best Practices for U.S Bike Routes
 

Building User Interfaces For iPhones 101

  • 1. Building User Interfaces for iPhone Applications 101 John Kennedy - February 2009 Friday, February 20, 2009
  • 2. Your tools: Xcode and Interface Builder, and the Cocoa Touch framework. Friday, February 20, 2009
  • 3. Xcode: the IDE that includes source code editor, tools, documentation and the front end for the compiler i.e. with Xcode you can enter, build and debug your application. Interface Builder: an editor program for dragging controls into your application’s views and editing them visually. Cocoa Touch: a framework of code for you to use. Cocoa Touch contains controls and other useful stuff for your iPhone applications. Friday, February 20, 2009
  • 4. The Cocoa Touch framework provides a code library called UIKit for creating iPhone-friendly controls. Controls can be created programmatically, but.. The Interface Builder tool makes almost all of the process ‘drag and drop’, and is the recommended approach whenever possible. Friday, February 20, 2009
  • 5. UIViewController is the UIKit class that provides the most fundamental support for all iPhone ‘views’. UIViewController, or its subclasses, can manage (amongst others) tab bars, navigation controls, and will even rotate the display for you automatically. Friday, February 20, 2009
  • 6. You could create your controls in your UIViewController subclass programmatically, by implementing the loadView method. Or you could use Interface Builder to create a NIB file that contains all the details of your view’s controls. That’s all a NIB file is: a way of storing a user interface. We’ll do it that way. Friday, February 20, 2009
  • 7. When you consider how your application works, it will probably have multiple views: for example; one that displays groups, and one that displays a list of names. Friday, February 20, 2009
  • 8. When you consider how your application works, it will probably have multiple views: for example; one that displays groups, and one that displays a list of names. Friday, February 20, 2009
  • 9. Remember that each view is a class, and so contains all the code that is required to do what it needs to do: for example, the class might contain code that creates a list of names and let the user select one. Your application works by switching between these different views. Friday, February 20, 2009
  • 10. How you switch between these views is up to you, and the design of your application. It is important to spend time in advance thinking about how your user will switch between views. Friday, February 20, 2009
  • 11. Sketch your design out on paper first, to make sure the ‘flow’ makes sense. Think about dividing information between views. Will all your settings be in one view? How many views are needed? Friday, February 20, 2009
  • 12. Sketch your design out on paper first, to make sure the ‘flow’ makes sense. Think about dividing information between views. Will all your settings be in one view? How many views are needed? Friday, February 20, 2009
  • 13. A Tab Bar control is one way the user could switch between your application’s views. Friday, February 20, 2009
  • 14. A Tab Bar control is one way the user could switch between your application’s views. Friday, February 20, 2009
  • 15. Other common design patterns include ‘drilling down’ from one view to another. Friday, February 20, 2009
  • 16. Other common design patterns include ‘drilling down’ from one view to another. Friday, February 20, 2009
  • 17. The UINavigationController handles this type of display for you, by maintaining a stack of views and providing navigation. Friday, February 20, 2009
  • 18. So what does each view look like, from the point of view of you, the programmer? Each views will be encapsulated in separate ‘chunks’ within your application. Friday, February 20, 2009
  • 19. Here’s what each view involves: Friday, February 20, 2009
  • 20. Here’s what each view involves: Created with Interface Builder, the NIB file NIB 1. contains the controls, buttons, and other elements File that you have visually designed. A class (comprised of a .m file, and a .h file) .m 2. which is a subclass of UIViewController. Xcode will .h quickly help you create these source files. Class NIB Friday, February 20, 2009
  • 21. The important part! NIB .m File .h You must introduce the NIB to the code so they know about each other. Friday, February 20, 2009
  • 22. The important part! NIB .m File .h You must introduce the NIB to the code so they know about each other. Friday, February 20, 2009
  • 23. Here’s a step-by-step guide to how you create a new view (both source code and NIB) and wire them together.. watch closely.. there is nothing up my sleeve.. Friday, February 20, 2009
  • 24. 1.0 Creating the source code. Select ‘Classes’ and Add -> New File... Friday, February 20, 2009
  • 25. 1.1 Creating the source code. Select UIViewController Class from Cocoa Touch Classes Friday, February 20, 2009
  • 26. 1.2 Creating the source code. Give it a name. I like to use the form XXXViewController. You don’t have to. Friday, February 20, 2009
  • 27. 1.3 Creating the source code. There you go: your .h and you .m file, describing a subclass of UIViewController. Friday, February 20, 2009
  • 28. 2.0 Create the NIB file part. This time select Resources as the folder, and Add -> New File. Friday, February 20, 2009
  • 29. 2.1 Create the NIB file part. Use a View.XIB template. (Note: XIB is the new, improved version of NIB. We just keep calling them NIB files for old time’s sake and to confuse noobs.) Friday, February 20, 2009
  • 30. 2.2 Create the NIB file part. Pick a name that will remind you which UIViewController class is associated with. Friday, February 20, 2009
  • 31. 2.3 Create the NIB file part. Enjoy your new NIB file as it opens in Interface Builder. The blank View panel is where you can drag and drop controls. Friday, February 20, 2009
  • 32. 2.4 Create the NIB file part. Drag some controls onto your View from the Library. Friday, February 20, 2009
  • 33. 3.0 Connect the NIB to the Class. Select File’s Owner, and make sure its class is set to be the ViewController class you just created. Friday, February 20, 2009
  • 34. 3.1 Connect the NIB to the Class. Connect the View to File’s Owner. (Option-Click on Files’s Owner and drag to View) Friday, February 20, 2009
  • 35. And that’s that. Friday, February 20, 2009
  • 36. But how do you make the views, you know, actually visible? Friday, February 20, 2009
  • 37. When your application launches, the default view (MainWindow.xib) will be displayed. Friday, February 20, 2009
  • 38. When your application launches, the default view (MainWindow.xib) will be displayed. This is the easiest way, and it means you can write a simple one-view application in about 60 seconds! Friday, February 20, 2009
  • 39. Other controls (such as Tab Bar controls) can link to the NIB files, thus causing them to appear. Friday, February 20, 2009
  • 40. Other controls (such as Tab Bar controls) can link to the NIB files, thus causing them to appear. This isn’t that hard either: you just need to remember to wire them up properly from Interface Builder. Friday, February 20, 2009
  • 41. You can create them programmatically from within your application. Friday, February 20, 2009
  • 42. You can create them programmatically from within your application. It turns out that only takes a few lines of Objective-C to open a View from a NIB and make it visible! Friday, February 20, 2009
  • 43. For example, this code creates a new view and uses a Navigation Controller to make it slide smoothly onto the screen. Friday, February 20, 2009
  • 44. See? It’s not as scary as you might think to create views and display them. For more information, there are several good 3rd party books including my favourite “iPhone SDK Development” from Pragmatic Programmers. Don’t forget: Apple has some surprisingly good documentation on its iPhone Developer site. Friday, February 20, 2009
  • 45. The End Please let me know of errors and omissions: john_kenn@mac.com Friday, February 20, 2009

Notas del editor