SlideShare a Scribd company logo
iOS Application Development
Working with Navigation and Tab Bar
These are confidential sessions - please refrain from streaming, blogging, or taking pictures
Session 13
Vu Tran Lam
IAD-2013
• iOS 7 app anatomy
• Navigation controllers introduction
• Understanding application data flow
• Working with navigation bar
• Working with toolbar
• Tab bar controllers introduction
• Customizing tab bar appearance
• Working with tab bar
• Combining navigation and tab bar controller
Today’s Topics
• UI elements provided by UIKit fall into four broad categories:
• Bars
• Content views
• Controls
• Temporary views
iOS App Anatomy
iOS App Anatomy
Navigation Controllers
• A navigation controller manages a stack of view controllers to
provide a drill-down interface for hierarchical content.
• The view hierarchy of a navigation controller is self contained. It is
composed of views that the navigation controller manages directly
and views that are managed by content view controllers you
provide.
• Each content view controller manages a distinct view hierarchy, and
the navigation controller coordinates the navigation between these
view hierarchies
Navigation Controller Introduction
Navigation Controller Introduction
Navigation sample
Navigation Controller Introduction
Navigation views
Navigation Controller Introduction
Navigation views
Objects of Navigation Interface
UINavigationController
toolbar
delegate
Custom delegate object
UIToolbar
viewControllers
(NSArray)
View controllerView controllerView controllerView controller
navigationBar UINavigationBar
delegate
Navigation stack
• Presence
• A controller for each screen
• Connecting view controllers
• How not to share data
• Best practices for data flow
Understanding Application Data Flow
Understanding Application Data Flow
Presence
A Controller for Each Screen
List View
Controller
Detail View
Controller
• Multiple view controllers may need to share data
• One may need to know about what another is doing
• Watch for added, removed or edited data
• Other interesting events
Connecting View Controllers
• Global variables or singletons
• This includes your application delegate
• Direct dependencies make your code less reusable
• And more difficult to debug & test
How Not to Share Data
Connecting View Controllers
List View
Controller
Detail View
Controller
Application Delegate
Connecting View Controllers
List View
Controller
Detail View
Controller
Application Delegate
Don’t Do This!
• Figure out exactly what needs to be communicated
• Define input parameters for your view controller
• For communicating back up the hierarchy, use loose coupling
• Define a generic interface for observers (like delegation)
Best Practices for Data Flow
Demo
Book Manager Demo
• Navigation bar introduction
• Anatomy of navigation bar
• Customizing navigation bar appearance
• Creating navigation bar
Navigation Bar
• Navigation bars allow you to present your app’s content in an
organised and intuitive way.
• A navigation bar is displayed at the top of the screen, and contains
buttons for navigating through a hierarchy of screens.
• A navigation bar generally has a back button, a title, and a right
button.
• The most common way to use a navigation bar is with a navigation
controller.
Navigation Bar Introduction
• Navigate to the previous view
• Transition to a new view
Purpose
• Navigation bars are implemented in the UINavigationBar class
• Navigation items are implemented in the UINavigationItem class
• Bar button items are implemented in the UIBarButtonItem class
• Bar items are implemented in the UIBarItem class
Implementation
• A navigation bar is a view that manages the controls in a navigation
interface, and it takes on a special role when managed by a
navigation controller object.
• The structure of a navigation bar is similar to the structure of a
navigation controller in many ways.
• Like a navigation controller, a navigation bar is a container for
content that is provided by other objects.
Anatomy of Navigation Bar
Anatomy of Navigation Bar
View controller View controller
UINavigationItem UINavigationItem
UIBarButtonItem
Previous view controller Current view controller
navigationItem navigationItem
backBarButtonItem
rightBarButtonItem
title
• You can customize the appearance of a navigation bar by setting
the properties depicted below:
Customizing Navigation Bar Appearance
• When a navigation bar is used with a navigation controller, you
always use the setNavigationBarHidden:animated: method of
UINavigationController to show and hide the navigation bar.
• You must never hide navigation bar by modifying UINavigationBar
object’s hidden property directly.
• To customize the appearance of the navigation bar for a specific
view controller, modify the attributes of UINavigationItem object.
• You can get the navigation item for a view controller from its
navigationItem property.
Customizing Bar Buttons
Customizing Bar Buttons
• To customize the appearance of the navigation bar for a specific
view controller, modify the attributes of UINavigationItem object.
• You can get the navigation item for a view controller from its
navigationItem property.
Customizing Bar Buttons
• To customize the appearance of the navigation bar for a specific
view controller, modify the attributes of UINavigationItem object.
• You can get the navigation item for a view controller from its
navigationItem property.
Customizing Bar Buttons
• To customize the appearance of the navigation bar for a specific
view controller, modify the attributes of UINavigationItem object.
• You can get the navigation item for a view controller from its
navigationItem property.
• Creating a navigation bar using storyboard
• Creating a navigation bar programmatically
• Creating a navigation bar button programmatically
Creating Navigation Bar
• Drag a navigation controller from the library.
• Interface Builder creates a navigation controller and a view controller,
and it creates a relationship between them.
• Display it as the first view controller by selecting the option “Is Initial
View Controller” in the Attributes inspector.
Creating a Navigation Bar Using Storyboard
1
2
3
• Create the root view controller for the navigation object.
Creating a Navigation Bar Programmatically
1
UIViewController *myViewController = [[MyViewController alloc] init]
• Create root view controller for navigation object.
• Initializing initWithRootViewController: method (navigation
controller).
Creating a Navigation Bar Programmatically
1
2
UINavigationController *navigationController = [[UINavigationController alloc]
initWithRootViewController:myViewController];
• Create root view controller for navigation object.
• Initializing initWithRootViewController: method (navigation
controller).
• Set navigation controller as root view controller of your window.
Creating a Navigation Bar Programmatically
1
2
3
window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
window.rootViewController = navigationController;
[window makeKeyAndVisible];
Creating a Navigation Bar Programmatically
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
// Create the root view controller for the navigation object
UIViewController *myViewController = [[MyViewController alloc] init];
// Initializing navigation controller using initWithRootViewController: method
navigationController = [[UINavigationController alloc]
initWithRootViewController:myViewController];
!
// Set navigation controller as root view controller of your window
window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
window.rootViewController = navigationController;
[window makeKeyAndVisible];
}
• Adding the right bar button
Creating a Navigation Bar Button
Programmatically
UIBarButtonItem *addButton = [[[UIBarButtonItem alloc] initWithTitle:@"Done"
style:UIBarButtonItemStyleBordered target:self action:@selector(addAction:)]
autorelease];
self.navigationItem.rightBarButtonItem = addButton;
Demo
Navigation Bar Demo
• Toolbar introduction
• Anatomy of toolbar
• Customizing toolbar appearance
• Creating toolbar
Toolbar
• A toolbar usually appears at the bottom of a screen, and displays
one or more buttons called toolbar items.
• Generally, these buttons provide some sort of tool that is relevant to
the screen’s current content.
• A toolbar is often used in conjunction with a navigation controller,
which manages both the navigation bar and the toolbar.
Toolbar Introduction
• Select one of a set of performable actions within a given view
Purpose
• Toolbars are implemented in the UIToolbar class
• Navigation items are implemented in the UINavigationItem class
• Bar items are implemented in the UIBarItem class
Implementation
• A navigation interface can display a toolbar and populate it with
items provided by the currently visible view controller.
• The toolbar itself is managed by the navigation controller object.
• To configure a toolbar for your navigation interface, you must do the
following:
• Show the toolbar by setting the toolbarHidden property of the
navigation controller object to NO.
• Assign an array of UIBarButtonItem objects to the toolbarItem
property of each of your content view controllers.
Anatomy of Toolbar
Anatomy of Toolbar
View controller
NSArray
Toolbar
Item
Toolbar
Item
Toolbar
Item
Toolbar
Item
Toolbar
Item
toolBarItems
• You can customize appearance of a toolbar by setting the
properties depicted below:
Customizing Navigation Bar Appearance
• To hide the toolbar, set hidesBottomBarWhenPushed property of
that view controller to YES.
• Creating a toolbar using storyboard
• Configuring a toolbar with a centered segmented control
Creating Toolbar
• Drag a toolbar from the library.
• Add two flexible space bar button items to the toolbar, by dragging
them from the library.
• Add a segmented control from the library, between the flexible
space bar buttons, by dragging it from the library.
Creating a Toolbar Using Storyboard
1
2
3
• Create flexible space button item for the toolbar
Creating a Toolbar Programmatically
1
UIBarButtonItem *flexibleSpaceButtonItem = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil
action:nil];
• Create flexible space button item for the toolbar
• Create and configure the segmented control
Creating a Toolbar Programmatically
1
2
UISegmentedControl *sortToggle = [[UISegmentedControl alloc] initWithItems:
[NSArray arrayWithObjects:@"Ascending", @"Descending", nil]];
sortToggle.segmentedControlStyle = UISegmentedControlStyleBar;
sortToggle.selectedSegmentIndex = 0;
[sortToggle addTarget:self action:@selector(toggleSorting:)
forControlEvents:UIControlEventValueChanged];
!
• Create flexible space button item for the toolbar
• Create and configure the segmented control
• Create the bar button item for the segmented control
Creating a Toolbar Programmatically
1
2
3
UIBarButtonItem *sortToggleButtonItem = [[UIBarButtonItem alloc]
initWithCustomView:sortToggle]
• Create flexible space button item for the toolbar
• Create and configure the segmented control
• Create the bar button item for the segmented control
• Set our toolbar items
Creating a Toolbar Programmatically
1
2
3
self.toolbarItems = [NSArray arrayWithObjects:flexibleSpaceButtonItem,
sortToggleButtonItem,flexibleSpaceButtonItem, nil];
4
Creating a Toolbar Programmatically
- (void)configureToolbarItems
{
// Create flexible space button item for the toolbar.
UIBarButtonItem *flexibleSpaceButtonItem = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil
action:nil];
// Create and configure the segmented control
UISegmentedControl *sortToggle = [[UISegmentedControl alloc]
initWithItems:[NSArray arrayWithObjects:@"Ascending", @"Descending", nil]];
sortToggle.segmentedControlStyle = UISegmentedControlStyleBar;
sortToggle.selectedSegmentIndex = 0;
[sortToggle addTarget:self action:@selector(toggleSorting:)
forControlEvents:UIControlEventValueChanged];
// Create the bar button item for the segmented control
UIBarButtonItem *sortToggleButtonItem = [[UIBarButtonItem alloc]
initWithCustomView:sortToggle];
// Set our toolbar items
self.toolbarItems = [NSArray arrayWithObjects:flexibleSpaceButtonItem,
sortToggleButtonItem,flexibleSpaceButtonItem, nil];
}
Demo
Toolbar Demo
Tab Bar Controllers
• A tab bar provides easy access to different views in an app. Use a
tab bar to organize information in your app by subtask.
• The most common way to use a tab bar is with a tab bar controller.
You can also use a tab bar as a standalone object in your app.
• The view hierarchy of a tab bar controller is self contained. It is
composed of views that the tab bar controller manages directly and
views that are managed by content view controllers you provide.
Tab Bar Controller Introduction
• Quickly navigate within an app
• Get an understanding of the app’s layout
Purpose
• Tab bars are implemented in the UITabBar class
• Tab bar items are implemented in the UITabBarItem class
Implementation
• The manager for a tab bar interface is a tab bar controller object.
• The tab bar controller creates and manages tab bar view and also
manages view controllers that provide content view for each mode.
• Each content view controller is designated as the view controller for
one of the tabs in the tab bar view.
• When a tab is tapped by the user, the tab bar controller object
selects the tab and displays the view associated with
corresponding content view controller.
Anatomy of Tab Bar
Anatomy of Tab Bar Interface
“Favorites”

bar
item
“Favorites”

view controller
Tab
bar
Tab
bar
tabBarItem
“Search”

view controller
“Featured”
view controller
Tab bar controller
NSArray
viewControllers
Tab
bar
tabBarItem
• You can customize appearance of a tab bar by setting the properties
depicted below:
Customizing Tab Bars Appearance
• UITabBarItem = Title + Image (System Item)
• Each view controller comes with a tab bar item for customizing
• Creating a tab bar interface using storyboard
• Creating a tab bar interface programmatically
• Creating a tab bar item programmatically
• Displaying more tab bar items
• Changing the tab’s badge
Working with Tab Bar
• Drag a tab bar controller from the library.
• Interface Builder creates a tab bar controller and two view
controllers, and it creates relationships between them.
• These relationships identify each of the newly created view
controllers as the view controller for one tab of the tab bar controller.
• Display it as the first view controller by selecting the option “Is Initial
View Controller” in the Attributes inspector
Creating a Tab Bar Interface Using Storyboard
1
2
3
4
• Create a new UITabBarController object
Creating a Tab Bar Interface Programmatically
tabBarController = [[UITabBarController alloc] init];
1
• Create a new UITabBarController object
• Create a content view controller for each tab
Creating a Tab Bar Interface Programmatically
MyViewController *vc1 = [[MyViewController alloc] init];
MyOtherViewController *vc2 = [[MyOtherViewController alloc] init];
1
2
• Create a new UITabBarController object
• Create a content view controller for each tab
• Add the view controllers to an array and assign that array to your
tab bar controller’s viewControllers property
Creating a Tab Bar Interface Programmatically
NSArray* controllers = [NSArray arrayWithObjects:vc1, vc2, nil];
tabBarController.viewControllers = controllers;
1
2
3
• Create a new UITabBarController object
• Create a content view controller for each tab
• Add the view controllers to an array and assign that array to your
tab bar controller’s viewControllers property
• Set the tab bar controller as the root view controller of your window
Creating a Tab Bar Interface Programmatically
window.rootViewController = tabBarController;
1
2
3
4
Creating a Tab Bar Interface Programmatically
- (void)applicationDidFinishLaunching:(UIApplication *)application
{
// Create a tab bar controller
tabBarController = [[UITabBarController alloc] init];
!
// Create content view controller for each tab
MyViewController *vc1 = [[MyViewController alloc] init];
MyOtherViewController *vc2 = [[MyOtherViewController alloc] init];
// Set the array of view controllers
NSArray* controllers = [NSArray arrayWithObjects:vc1, vc2, nil];
tabBarController.viewControllers = controllers;
// Add the tab bar controller’s view to the window
window.rootViewController = tabBarController;
}
• Custom item with title and image:
Creating a Tab Bar Item Programmatically
self.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"Footprints"
image:[UIImage imageNamed:@"footprints.png"] tag:0];
• Custom item with title and image:
• System item:
Creating a Tab Bar Item Programmatically
self.tabBarItem = [[UITabBarItem alloc]initWithTabBarSystemItem:
UITabBarSystemItemContacts tag:0];
• When there are more than four tab bar items, you must you More
view controller.
• If you use the storyboard to create tab bar items, Xcode will
automatically add More view controller in the tab bar.
• Purpose of More view controller:
• Choose more tab bar item
• Rearrange the tab bar item
Displaying More Tab Bar Items
Creating a Tab Bar Interface Programmatically
Creating a Tab Bar Interface Programmatically
Creating a Tab Bar Interface Programmatically
• A badge is a small red marker displayed in the corner of the tab.
Inside the badge is some custom text that you provide.
• Typically, badges contain numerical values reflecting the number of
new items available on the tab, but you can also specify very short
character strings too.
Changing Tab’s Badge
NSString *value = self.badgeField.text;
self.tabBarItem.badgeValue = value;
Demo
Simple Tab Bar Demo
Demo
More Tab Bar Demo
UIKit User Interface Catalog
https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/UIKitUICatalog/index.html
UIKit Transition Guide
https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/TransitionGuide/index.html
Asset Catalog Help
https://developer.apple.com/library/ios/recipes/xcode_help-image_catalog-1.0/Recipe.html
View Controller Catalog for iOS
https://developer.apple.com/library/ios/documentation/WindowsViews/Conceptual/ViewControllerCatalog/
Introduction.html
Documentation
many thanks
to
lamvt@fpt.com.vn
please
say
Stanford University
https://developer.apple.com
Developer Center
http://www.stanford.edu/class/cs193p
xin
chào
Next: Working with Table View and Search Bar

More Related Content

What's hot

18 Invaluable Lessons About ADF-JSF Interaction
18 Invaluable Lessons About ADF-JSF Interaction18 Invaluable Lessons About ADF-JSF Interaction
18 Invaluable Lessons About ADF-JSF Interaction
Steven Davelaar
 
Angular
AngularAngular
Angular
Lilia Sfaxi
 
Node.JS error handling best practices
Node.JS error handling best practicesNode.JS error handling best practices
Node.JS error handling best practices
Yoni Goldberg
 
Conhecendo o Spring
Conhecendo o SpringConhecendo o Spring
Conhecendo o Spring
Maurício Linhares
 
Spring JDBCTemplate
Spring JDBCTemplateSpring JDBCTemplate
Spring JDBCTemplateGuo Albert
 
MVVM in iOS presentation
MVVM in iOS presentationMVVM in iOS presentation
MVVM in iOS presentation
G ABHISEK
 
Modernizing Adobe Experience Manager (AEM)
Modernizing Adobe Experience Manager (AEM)Modernizing Adobe Experience Manager (AEM)
Modernizing Adobe Experience Manager (AEM)
Gabriel Walt
 
Angular modules in depth
Angular modules in depthAngular modules in depth
Angular modules in depth
Christoffer Noring
 
Angular - Chapter 1 - Introduction
 Angular - Chapter 1 - Introduction Angular - Chapter 1 - Introduction
Angular - Chapter 1 - Introduction
WebStackAcademy
 
Angular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP ServicesAngular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP Services
WebStackAcademy
 
안드로이드 윈도우 마스터 되기
안드로이드 윈도우 마스터 되기안드로이드 윈도우 마스터 되기
안드로이드 윈도우 마스터 되기
Myungwook Ahn
 
Angular - Chapter 5 - Directives
 Angular - Chapter 5 - Directives Angular - Chapter 5 - Directives
Angular - Chapter 5 - Directives
WebStackAcademy
 
Why MVC?
Why MVC?Why MVC?
Why MVC?
Wayne Tun Myint
 
OpenGL 4.6 Reference Guide
OpenGL 4.6 Reference GuideOpenGL 4.6 Reference Guide
OpenGL 4.6 Reference Guide
The Khronos Group Inc.
 
Goodbye Nightmare: Tips and Tricks for Creating Complex Layouts with Oracle A...
Goodbye Nightmare: Tips and Tricks for Creating Complex Layouts with Oracle A...Goodbye Nightmare: Tips and Tricks for Creating Complex Layouts with Oracle A...
Goodbye Nightmare: Tips and Tricks for Creating Complex Layouts with Oracle A...
Getting value from IoT, Integration and Data Analytics
 
Optimize CollectionView Scrolling
Optimize CollectionView ScrollingOptimize CollectionView Scrolling
Optimize CollectionView Scrolling
Andrea Prearo
 
Refractive surgery for GP's
Refractive surgery for GP'sRefractive surgery for GP's
Refractive surgery for GP's
perfectvision
 
Angular interview questions
Angular interview questionsAngular interview questions
Angular interview questions
Goa App
 

What's hot (20)

18 Invaluable Lessons About ADF-JSF Interaction
18 Invaluable Lessons About ADF-JSF Interaction18 Invaluable Lessons About ADF-JSF Interaction
18 Invaluable Lessons About ADF-JSF Interaction
 
Maven
MavenMaven
Maven
 
Angular
AngularAngular
Angular
 
Node.JS error handling best practices
Node.JS error handling best practicesNode.JS error handling best practices
Node.JS error handling best practices
 
Builder pattern
Builder patternBuilder pattern
Builder pattern
 
Conhecendo o Spring
Conhecendo o SpringConhecendo o Spring
Conhecendo o Spring
 
Spring JDBCTemplate
Spring JDBCTemplateSpring JDBCTemplate
Spring JDBCTemplate
 
MVVM in iOS presentation
MVVM in iOS presentationMVVM in iOS presentation
MVVM in iOS presentation
 
Modernizing Adobe Experience Manager (AEM)
Modernizing Adobe Experience Manager (AEM)Modernizing Adobe Experience Manager (AEM)
Modernizing Adobe Experience Manager (AEM)
 
Angular modules in depth
Angular modules in depthAngular modules in depth
Angular modules in depth
 
Angular - Chapter 1 - Introduction
 Angular - Chapter 1 - Introduction Angular - Chapter 1 - Introduction
Angular - Chapter 1 - Introduction
 
Angular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP ServicesAngular - Chapter 7 - HTTP Services
Angular - Chapter 7 - HTTP Services
 
안드로이드 윈도우 마스터 되기
안드로이드 윈도우 마스터 되기안드로이드 윈도우 마스터 되기
안드로이드 윈도우 마스터 되기
 
Angular - Chapter 5 - Directives
 Angular - Chapter 5 - Directives Angular - Chapter 5 - Directives
Angular - Chapter 5 - Directives
 
Why MVC?
Why MVC?Why MVC?
Why MVC?
 
OpenGL 4.6 Reference Guide
OpenGL 4.6 Reference GuideOpenGL 4.6 Reference Guide
OpenGL 4.6 Reference Guide
 
Goodbye Nightmare: Tips and Tricks for Creating Complex Layouts with Oracle A...
Goodbye Nightmare: Tips and Tricks for Creating Complex Layouts with Oracle A...Goodbye Nightmare: Tips and Tricks for Creating Complex Layouts with Oracle A...
Goodbye Nightmare: Tips and Tricks for Creating Complex Layouts with Oracle A...
 
Optimize CollectionView Scrolling
Optimize CollectionView ScrollingOptimize CollectionView Scrolling
Optimize CollectionView Scrolling
 
Refractive surgery for GP's
Refractive surgery for GP'sRefractive surgery for GP's
Refractive surgery for GP's
 
Angular interview questions
Angular interview questionsAngular interview questions
Angular interview questions
 

Similar to Session 13 - Working with navigation and tab bar

Android and IOS UI Development (Android 5.0 and iOS 9.0)
Android and IOS UI Development (Android 5.0 and iOS 9.0)Android and IOS UI Development (Android 5.0 and iOS 9.0)
Android and IOS UI Development (Android 5.0 and iOS 9.0)Michael Shrove
 
아이폰강의(5) pdf
아이폰강의(5) pdf아이폰강의(5) pdf
아이폰강의(5) pdfsunwooindia
 
Intro to UIKit • Made by Many
Intro to UIKit • Made by ManyIntro to UIKit • Made by Many
Intro to UIKit • Made by Many
kenatmxm
 
Session 14 - Working with table view and search bar
Session 14 - Working with table view and search barSession 14 - Working with table view and search bar
Session 14 - Working with table view and search barVu Tran Lam
 
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 05)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 05)iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 05)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 05)
Jonathan Engelsma
 
Session 8 - Xcode 5 and interface builder for iOS 7 application
Session 8 - Xcode 5 and interface builder for iOS 7 applicationSession 8 - Xcode 5 and interface builder for iOS 7 application
Session 8 - Xcode 5 and interface builder for iOS 7 applicationVu Tran Lam
 
Session 16 - Designing universal interface which used for iPad and iPhone
Session 16  -  Designing universal interface which used for iPad and iPhoneSession 16  -  Designing universal interface which used for iPad and iPhone
Session 16 - Designing universal interface which used for iPad and iPhoneVu Tran Lam
 
Introduction of Xcode
Introduction of XcodeIntroduction of Xcode
Introduction of Xcode
Dhaval Kaneria
 
IOS- Designing with ui tool bar in ios
IOS-  Designing with ui tool bar in iosIOS-  Designing with ui tool bar in ios
IOS- Designing with ui tool bar in ios
Vibrant Technologies & Computers
 
iPhone Development: Multiple Views
iPhone Development: Multiple ViewsiPhone Development: Multiple Views
iPhone Development: Multiple ViewsJussi Pohjolainen
 
Session 15 - Working with Image, Scroll, Collection, Picker, and Web View
Session 15  - Working with Image, Scroll, Collection, Picker, and Web ViewSession 15  - Working with Image, Scroll, Collection, Picker, and Web View
Session 15 - Working with Image, Scroll, Collection, Picker, and Web View
Vu Tran Lam
 
iOS Development: What's New
iOS Development: What's NewiOS Development: What's New
iOS Development: What's NewNascentDigital
 
Apple Watch and WatchKit - A Technical Overview
Apple Watch and WatchKit - A Technical OverviewApple Watch and WatchKit - A Technical Overview
Apple Watch and WatchKit - A Technical Overview
Sammy Sunny
 
April iOS Meetup - UIAppearance Presentation
April iOS Meetup - UIAppearance PresentationApril iOS Meetup - UIAppearance Presentation
April iOS Meetup - UIAppearance PresentationLong Weekend LLC
 
SUG Bangalore - Extending Sitecore Experience Commerce 9 Business Tools
SUG Bangalore - Extending Sitecore Experience Commerce 9 Business ToolsSUG Bangalore - Extending Sitecore Experience Commerce 9 Business Tools
SUG Bangalore - Extending Sitecore Experience Commerce 9 Business Tools
Anindita Bhattacharya
 
IOS APPs Revision
IOS APPs RevisionIOS APPs Revision
IOS APPs Revision
Muhammad Amin
 
Scroll views
Scroll viewsScroll views
Scroll views
SV.CO
 

Similar to Session 13 - Working with navigation and tab bar (20)

Android and IOS UI Development (Android 5.0 and iOS 9.0)
Android and IOS UI Development (Android 5.0 and iOS 9.0)Android and IOS UI Development (Android 5.0 and iOS 9.0)
Android and IOS UI Development (Android 5.0 and iOS 9.0)
 
занятие6
занятие6занятие6
занятие6
 
아이폰강의(5) pdf
아이폰강의(5) pdf아이폰강의(5) pdf
아이폰강의(5) pdf
 
Intro to UIKit • Made by Many
Intro to UIKit • Made by ManyIntro to UIKit • Made by Many
Intro to UIKit • Made by Many
 
iOS: View Controllers
iOS: View ControllersiOS: View Controllers
iOS: View Controllers
 
Ui 5
Ui   5Ui   5
Ui 5
 
Session 14 - Working with table view and search bar
Session 14 - Working with table view and search barSession 14 - Working with table view and search bar
Session 14 - Working with table view and search bar
 
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 05)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 05)iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 05)
iOS Bootcamp: learning to create awesome apps on iOS using Swift (Lecture 05)
 
Session 8 - Xcode 5 and interface builder for iOS 7 application
Session 8 - Xcode 5 and interface builder for iOS 7 applicationSession 8 - Xcode 5 and interface builder for iOS 7 application
Session 8 - Xcode 5 and interface builder for iOS 7 application
 
Session 16 - Designing universal interface which used for iPad and iPhone
Session 16  -  Designing universal interface which used for iPad and iPhoneSession 16  -  Designing universal interface which used for iPad and iPhone
Session 16 - Designing universal interface which used for iPad and iPhone
 
Introduction of Xcode
Introduction of XcodeIntroduction of Xcode
Introduction of Xcode
 
IOS- Designing with ui tool bar in ios
IOS-  Designing with ui tool bar in iosIOS-  Designing with ui tool bar in ios
IOS- Designing with ui tool bar in ios
 
iPhone Development: Multiple Views
iPhone Development: Multiple ViewsiPhone Development: Multiple Views
iPhone Development: Multiple Views
 
Session 15 - Working with Image, Scroll, Collection, Picker, and Web View
Session 15  - Working with Image, Scroll, Collection, Picker, and Web ViewSession 15  - Working with Image, Scroll, Collection, Picker, and Web View
Session 15 - Working with Image, Scroll, Collection, Picker, and Web View
 
iOS Development: What's New
iOS Development: What's NewiOS Development: What's New
iOS Development: What's New
 
Apple Watch and WatchKit - A Technical Overview
Apple Watch and WatchKit - A Technical OverviewApple Watch and WatchKit - A Technical Overview
Apple Watch and WatchKit - A Technical Overview
 
April iOS Meetup - UIAppearance Presentation
April iOS Meetup - UIAppearance PresentationApril iOS Meetup - UIAppearance Presentation
April iOS Meetup - UIAppearance Presentation
 
SUG Bangalore - Extending Sitecore Experience Commerce 9 Business Tools
SUG Bangalore - Extending Sitecore Experience Commerce 9 Business ToolsSUG Bangalore - Extending Sitecore Experience Commerce 9 Business Tools
SUG Bangalore - Extending Sitecore Experience Commerce 9 Business Tools
 
IOS APPs Revision
IOS APPs RevisionIOS APPs Revision
IOS APPs Revision
 
Scroll views
Scroll viewsScroll views
Scroll views
 

More from Vu Tran Lam

Session 12 - Overview of taps, multitouch, and gestures
Session 12 - Overview of taps, multitouch, and gestures Session 12 - Overview of taps, multitouch, and gestures
Session 12 - Overview of taps, multitouch, and gestures Vu Tran Lam
 
Session 9-10 - UI/UX design for iOS 7 application
Session 9-10 - UI/UX design for iOS 7 applicationSession 9-10 - UI/UX design for iOS 7 application
Session 9-10 - UI/UX design for iOS 7 applicationVu Tran Lam
 
Session 7 - Overview of the iOS7 app development architecture
Session 7 - Overview of the iOS7 app development architectureSession 7 - Overview of the iOS7 app development architecture
Session 7 - Overview of the iOS7 app development architectureVu Tran Lam
 
Session 5 - Foundation framework
Session 5 - Foundation frameworkSession 5 - Foundation framework
Session 5 - Foundation frameworkVu Tran Lam
 
Session 4 - Object oriented programming with Objective-C (part 2)
Session 4  - Object oriented programming with Objective-C (part 2)Session 4  - Object oriented programming with Objective-C (part 2)
Session 4 - Object oriented programming with Objective-C (part 2)Vu Tran Lam
 
Session 3 - Object oriented programming with Objective-C (part 1)
Session 3 - Object oriented programming with Objective-C (part 1)Session 3 - Object oriented programming with Objective-C (part 1)
Session 3 - Object oriented programming with Objective-C (part 1)Vu Tran Lam
 
Session 2 - Objective-C basics
Session 2 - Objective-C basicsSession 2 - Objective-C basics
Session 2 - Objective-C basicsVu Tran Lam
 
iOS 7 Application Development Course
iOS 7 Application Development CourseiOS 7 Application Development Course
iOS 7 Application Development Course
Vu Tran Lam
 
Session 1 - Introduction to iOS 7 and SDK
Session 1 -  Introduction to iOS 7 and SDKSession 1 -  Introduction to iOS 7 and SDK
Session 1 - Introduction to iOS 7 and SDK
Vu Tran Lam
 
Succeed in Mobile career
Succeed in Mobile careerSucceed in Mobile career
Succeed in Mobile career
Vu Tran Lam
 
Android Application Development Course
Android Application Development Course Android Application Development Course
Android Application Development Course
Vu Tran Lam
 
Your Second iPhone App - Code Listings
Your Second iPhone App - Code ListingsYour Second iPhone App - Code Listings
Your Second iPhone App - Code Listings
Vu Tran Lam
 
Introduction to MVC in iPhone Development
Introduction to MVC in iPhone DevelopmentIntroduction to MVC in iPhone Development
Introduction to MVC in iPhone Development
Vu Tran Lam
 
Building a Completed iPhone App
Building a Completed iPhone AppBuilding a Completed iPhone App
Building a Completed iPhone App
Vu Tran Lam
 
Introduction to iPhone Programming
Introduction to iPhone Programming Introduction to iPhone Programming
Introduction to iPhone Programming
Vu Tran Lam
 
Responsive Web Design
Responsive Web DesignResponsive Web Design
Responsive Web Design
Vu Tran Lam
 
HTML5 Web Standards
HTML5 Web StandardsHTML5 Web Standards
HTML5 Web Standards
Vu Tran Lam
 
3D & Animation Effects Using CSS3 & jQuery
3D & Animation Effects Using CSS3 & jQuery3D & Animation Effects Using CSS3 & jQuery
3D & Animation Effects Using CSS3 & jQueryVu Tran Lam
 

More from Vu Tran Lam (18)

Session 12 - Overview of taps, multitouch, and gestures
Session 12 - Overview of taps, multitouch, and gestures Session 12 - Overview of taps, multitouch, and gestures
Session 12 - Overview of taps, multitouch, and gestures
 
Session 9-10 - UI/UX design for iOS 7 application
Session 9-10 - UI/UX design for iOS 7 applicationSession 9-10 - UI/UX design for iOS 7 application
Session 9-10 - UI/UX design for iOS 7 application
 
Session 7 - Overview of the iOS7 app development architecture
Session 7 - Overview of the iOS7 app development architectureSession 7 - Overview of the iOS7 app development architecture
Session 7 - Overview of the iOS7 app development architecture
 
Session 5 - Foundation framework
Session 5 - Foundation frameworkSession 5 - Foundation framework
Session 5 - Foundation framework
 
Session 4 - Object oriented programming with Objective-C (part 2)
Session 4  - Object oriented programming with Objective-C (part 2)Session 4  - Object oriented programming with Objective-C (part 2)
Session 4 - Object oriented programming with Objective-C (part 2)
 
Session 3 - Object oriented programming with Objective-C (part 1)
Session 3 - Object oriented programming with Objective-C (part 1)Session 3 - Object oriented programming with Objective-C (part 1)
Session 3 - Object oriented programming with Objective-C (part 1)
 
Session 2 - Objective-C basics
Session 2 - Objective-C basicsSession 2 - Objective-C basics
Session 2 - Objective-C basics
 
iOS 7 Application Development Course
iOS 7 Application Development CourseiOS 7 Application Development Course
iOS 7 Application Development Course
 
Session 1 - Introduction to iOS 7 and SDK
Session 1 -  Introduction to iOS 7 and SDKSession 1 -  Introduction to iOS 7 and SDK
Session 1 - Introduction to iOS 7 and SDK
 
Succeed in Mobile career
Succeed in Mobile careerSucceed in Mobile career
Succeed in Mobile career
 
Android Application Development Course
Android Application Development Course Android Application Development Course
Android Application Development Course
 
Your Second iPhone App - Code Listings
Your Second iPhone App - Code ListingsYour Second iPhone App - Code Listings
Your Second iPhone App - Code Listings
 
Introduction to MVC in iPhone Development
Introduction to MVC in iPhone DevelopmentIntroduction to MVC in iPhone Development
Introduction to MVC in iPhone Development
 
Building a Completed iPhone App
Building a Completed iPhone AppBuilding a Completed iPhone App
Building a Completed iPhone App
 
Introduction to iPhone Programming
Introduction to iPhone Programming Introduction to iPhone Programming
Introduction to iPhone Programming
 
Responsive Web Design
Responsive Web DesignResponsive Web Design
Responsive Web Design
 
HTML5 Web Standards
HTML5 Web StandardsHTML5 Web Standards
HTML5 Web Standards
 
3D & Animation Effects Using CSS3 & jQuery
3D & Animation Effects Using CSS3 & jQuery3D & Animation Effects Using CSS3 & jQuery
3D & Animation Effects Using CSS3 & jQuery
 

Recently uploaded

When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
Elena Simperl
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
Elena Simperl
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Ramesh Iyer
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
Thijs Feryn
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
Sri Ambati
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
DianaGray10
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
Cheryl Hung
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Jeffrey Haguewood
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
Dorra BARTAGUIZ
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
OnBoard
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
BookNet Canada
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
Product School
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
Alan Dix
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
RTTS
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
ControlCase
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Product School
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Product School
 

Recently uploaded (20)

When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...When stars align: studies in data quality, knowledge graphs, and machine lear...
When stars align: studies in data quality, knowledge graphs, and machine lear...
 
Knowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and backKnowledge engineering: from people to machines and back
Knowledge engineering: from people to machines and back
 
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
Builder.ai Founder Sachin Dev Duggal's Strategic Approach to Create an Innova...
 
Accelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish CachingAccelerate your Kubernetes clusters with Varnish Caching
Accelerate your Kubernetes clusters with Varnish Caching
 
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
GenAISummit 2024 May 28 Sri Ambati Keynote: AGI Belongs to The Community in O...
 
Connector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a buttonConnector Corner: Automate dynamic content and events by pushing a button
Connector Corner: Automate dynamic content and events by pushing a button
 
Key Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdfKey Trends Shaping the Future of Infrastructure.pdf
Key Trends Shaping the Future of Infrastructure.pdf
 
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdfFIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
FIDO Alliance Osaka Seminar: Passkeys at Amazon.pdf
 
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
Slack (or Teams) Automation for Bonterra Impact Management (fka Social Soluti...
 
Elevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object CalisthenicsElevating Tactical DDD Patterns Through Object Calisthenics
Elevating Tactical DDD Patterns Through Object Calisthenics
 
Leading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdfLeading Change strategies and insights for effective change management pdf 1.pdf
Leading Change strategies and insights for effective change management pdf 1.pdf
 
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...Transcript: Selling digital books in 2024: Insights from industry leaders - T...
Transcript: Selling digital books in 2024: Insights from industry leaders - T...
 
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
De-mystifying Zero to One: Design Informed Techniques for Greenfield Innovati...
 
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdfFIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
FIDO Alliance Osaka Seminar: The WebAuthn API and Discoverable Credentials.pdf
 
FIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdfFIDO Alliance Osaka Seminar: Overview.pdf
FIDO Alliance Osaka Seminar: Overview.pdf
 
Epistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI supportEpistemic Interaction - tuning interfaces to provide information for AI support
Epistemic Interaction - tuning interfaces to provide information for AI support
 
JMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and GrafanaJMeter webinar - integration with InfluxDB and Grafana
JMeter webinar - integration with InfluxDB and Grafana
 
PCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase TeamPCI PIN Basics Webinar from the Controlcase Team
PCI PIN Basics Webinar from the Controlcase Team
 
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
Unsubscribed: Combat Subscription Fatigue With a Membership Mentality by Head...
 
Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...Designing Great Products: The Power of Design and Leadership by Chief Designe...
Designing Great Products: The Power of Design and Leadership by Chief Designe...
 

Session 13 - Working with navigation and tab bar

  • 2. Working with Navigation and Tab Bar These are confidential sessions - please refrain from streaming, blogging, or taking pictures Session 13 Vu Tran Lam IAD-2013
  • 3. • iOS 7 app anatomy • Navigation controllers introduction • Understanding application data flow • Working with navigation bar • Working with toolbar • Tab bar controllers introduction • Customizing tab bar appearance • Working with tab bar • Combining navigation and tab bar controller Today’s Topics
  • 4. • UI elements provided by UIKit fall into four broad categories: • Bars • Content views • Controls • Temporary views iOS App Anatomy
  • 7. • A navigation controller manages a stack of view controllers to provide a drill-down interface for hierarchical content. • The view hierarchy of a navigation controller is self contained. It is composed of views that the navigation controller manages directly and views that are managed by content view controllers you provide. • Each content view controller manages a distinct view hierarchy, and the navigation controller coordinates the navigation between these view hierarchies Navigation Controller Introduction
  • 11. Objects of Navigation Interface UINavigationController toolbar delegate Custom delegate object UIToolbar viewControllers (NSArray) View controllerView controllerView controllerView controller navigationBar UINavigationBar delegate Navigation stack
  • 12. • Presence • A controller for each screen • Connecting view controllers • How not to share data • Best practices for data flow Understanding Application Data Flow
  • 15. A Controller for Each Screen List View Controller Detail View Controller
  • 16. • Multiple view controllers may need to share data • One may need to know about what another is doing • Watch for added, removed or edited data • Other interesting events Connecting View Controllers
  • 17. • Global variables or singletons • This includes your application delegate • Direct dependencies make your code less reusable • And more difficult to debug & test How Not to Share Data
  • 18. Connecting View Controllers List View Controller Detail View Controller Application Delegate
  • 19. Connecting View Controllers List View Controller Detail View Controller Application Delegate Don’t Do This!
  • 20. • Figure out exactly what needs to be communicated • Define input parameters for your view controller • For communicating back up the hierarchy, use loose coupling • Define a generic interface for observers (like delegation) Best Practices for Data Flow
  • 22. • Navigation bar introduction • Anatomy of navigation bar • Customizing navigation bar appearance • Creating navigation bar Navigation Bar
  • 23. • Navigation bars allow you to present your app’s content in an organised and intuitive way. • A navigation bar is displayed at the top of the screen, and contains buttons for navigating through a hierarchy of screens. • A navigation bar generally has a back button, a title, and a right button. • The most common way to use a navigation bar is with a navigation controller. Navigation Bar Introduction
  • 24. • Navigate to the previous view • Transition to a new view Purpose
  • 25. • Navigation bars are implemented in the UINavigationBar class • Navigation items are implemented in the UINavigationItem class • Bar button items are implemented in the UIBarButtonItem class • Bar items are implemented in the UIBarItem class Implementation
  • 26. • A navigation bar is a view that manages the controls in a navigation interface, and it takes on a special role when managed by a navigation controller object. • The structure of a navigation bar is similar to the structure of a navigation controller in many ways. • Like a navigation controller, a navigation bar is a container for content that is provided by other objects. Anatomy of Navigation Bar
  • 27. Anatomy of Navigation Bar View controller View controller UINavigationItem UINavigationItem UIBarButtonItem Previous view controller Current view controller navigationItem navigationItem backBarButtonItem rightBarButtonItem title
  • 28. • You can customize the appearance of a navigation bar by setting the properties depicted below: Customizing Navigation Bar Appearance • When a navigation bar is used with a navigation controller, you always use the setNavigationBarHidden:animated: method of UINavigationController to show and hide the navigation bar. • You must never hide navigation bar by modifying UINavigationBar object’s hidden property directly.
  • 29. • To customize the appearance of the navigation bar for a specific view controller, modify the attributes of UINavigationItem object. • You can get the navigation item for a view controller from its navigationItem property. Customizing Bar Buttons
  • 30. Customizing Bar Buttons • To customize the appearance of the navigation bar for a specific view controller, modify the attributes of UINavigationItem object. • You can get the navigation item for a view controller from its navigationItem property.
  • 31. Customizing Bar Buttons • To customize the appearance of the navigation bar for a specific view controller, modify the attributes of UINavigationItem object. • You can get the navigation item for a view controller from its navigationItem property.
  • 32. Customizing Bar Buttons • To customize the appearance of the navigation bar for a specific view controller, modify the attributes of UINavigationItem object. • You can get the navigation item for a view controller from its navigationItem property.
  • 33. • Creating a navigation bar using storyboard • Creating a navigation bar programmatically • Creating a navigation bar button programmatically Creating Navigation Bar
  • 34. • Drag a navigation controller from the library. • Interface Builder creates a navigation controller and a view controller, and it creates a relationship between them. • Display it as the first view controller by selecting the option “Is Initial View Controller” in the Attributes inspector. Creating a Navigation Bar Using Storyboard 1 2 3
  • 35. • Create the root view controller for the navigation object. Creating a Navigation Bar Programmatically 1 UIViewController *myViewController = [[MyViewController alloc] init]
  • 36. • Create root view controller for navigation object. • Initializing initWithRootViewController: method (navigation controller). Creating a Navigation Bar Programmatically 1 2 UINavigationController *navigationController = [[UINavigationController alloc] initWithRootViewController:myViewController];
  • 37. • Create root view controller for navigation object. • Initializing initWithRootViewController: method (navigation controller). • Set navigation controller as root view controller of your window. Creating a Navigation Bar Programmatically 1 2 3 window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; window.rootViewController = navigationController; [window makeKeyAndVisible];
  • 38. Creating a Navigation Bar Programmatically - (void)applicationDidFinishLaunching:(UIApplication *)application { // Create the root view controller for the navigation object UIViewController *myViewController = [[MyViewController alloc] init]; // Initializing navigation controller using initWithRootViewController: method navigationController = [[UINavigationController alloc] initWithRootViewController:myViewController]; ! // Set navigation controller as root view controller of your window window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; window.rootViewController = navigationController; [window makeKeyAndVisible]; }
  • 39. • Adding the right bar button Creating a Navigation Bar Button Programmatically UIBarButtonItem *addButton = [[[UIBarButtonItem alloc] initWithTitle:@"Done" style:UIBarButtonItemStyleBordered target:self action:@selector(addAction:)] autorelease]; self.navigationItem.rightBarButtonItem = addButton;
  • 41. • Toolbar introduction • Anatomy of toolbar • Customizing toolbar appearance • Creating toolbar Toolbar
  • 42. • A toolbar usually appears at the bottom of a screen, and displays one or more buttons called toolbar items. • Generally, these buttons provide some sort of tool that is relevant to the screen’s current content. • A toolbar is often used in conjunction with a navigation controller, which manages both the navigation bar and the toolbar. Toolbar Introduction
  • 43. • Select one of a set of performable actions within a given view Purpose
  • 44. • Toolbars are implemented in the UIToolbar class • Navigation items are implemented in the UINavigationItem class • Bar items are implemented in the UIBarItem class Implementation
  • 45. • A navigation interface can display a toolbar and populate it with items provided by the currently visible view controller. • The toolbar itself is managed by the navigation controller object. • To configure a toolbar for your navigation interface, you must do the following: • Show the toolbar by setting the toolbarHidden property of the navigation controller object to NO. • Assign an array of UIBarButtonItem objects to the toolbarItem property of each of your content view controllers. Anatomy of Toolbar
  • 46. Anatomy of Toolbar View controller NSArray Toolbar Item Toolbar Item Toolbar Item Toolbar Item Toolbar Item toolBarItems
  • 47. • You can customize appearance of a toolbar by setting the properties depicted below: Customizing Navigation Bar Appearance • To hide the toolbar, set hidesBottomBarWhenPushed property of that view controller to YES.
  • 48. • Creating a toolbar using storyboard • Configuring a toolbar with a centered segmented control Creating Toolbar
  • 49. • Drag a toolbar from the library. • Add two flexible space bar button items to the toolbar, by dragging them from the library. • Add a segmented control from the library, between the flexible space bar buttons, by dragging it from the library. Creating a Toolbar Using Storyboard 1 2 3
  • 50. • Create flexible space button item for the toolbar Creating a Toolbar Programmatically 1 UIBarButtonItem *flexibleSpaceButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil];
  • 51. • Create flexible space button item for the toolbar • Create and configure the segmented control Creating a Toolbar Programmatically 1 2 UISegmentedControl *sortToggle = [[UISegmentedControl alloc] initWithItems: [NSArray arrayWithObjects:@"Ascending", @"Descending", nil]]; sortToggle.segmentedControlStyle = UISegmentedControlStyleBar; sortToggle.selectedSegmentIndex = 0; [sortToggle addTarget:self action:@selector(toggleSorting:) forControlEvents:UIControlEventValueChanged]; !
  • 52. • Create flexible space button item for the toolbar • Create and configure the segmented control • Create the bar button item for the segmented control Creating a Toolbar Programmatically 1 2 3 UIBarButtonItem *sortToggleButtonItem = [[UIBarButtonItem alloc] initWithCustomView:sortToggle]
  • 53. • Create flexible space button item for the toolbar • Create and configure the segmented control • Create the bar button item for the segmented control • Set our toolbar items Creating a Toolbar Programmatically 1 2 3 self.toolbarItems = [NSArray arrayWithObjects:flexibleSpaceButtonItem, sortToggleButtonItem,flexibleSpaceButtonItem, nil]; 4
  • 54. Creating a Toolbar Programmatically - (void)configureToolbarItems { // Create flexible space button item for the toolbar. UIBarButtonItem *flexibleSpaceButtonItem = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]; // Create and configure the segmented control UISegmentedControl *sortToggle = [[UISegmentedControl alloc] initWithItems:[NSArray arrayWithObjects:@"Ascending", @"Descending", nil]]; sortToggle.segmentedControlStyle = UISegmentedControlStyleBar; sortToggle.selectedSegmentIndex = 0; [sortToggle addTarget:self action:@selector(toggleSorting:) forControlEvents:UIControlEventValueChanged]; // Create the bar button item for the segmented control UIBarButtonItem *sortToggleButtonItem = [[UIBarButtonItem alloc] initWithCustomView:sortToggle]; // Set our toolbar items self.toolbarItems = [NSArray arrayWithObjects:flexibleSpaceButtonItem, sortToggleButtonItem,flexibleSpaceButtonItem, nil]; }
  • 57. • A tab bar provides easy access to different views in an app. Use a tab bar to organize information in your app by subtask. • The most common way to use a tab bar is with a tab bar controller. You can also use a tab bar as a standalone object in your app. • The view hierarchy of a tab bar controller is self contained. It is composed of views that the tab bar controller manages directly and views that are managed by content view controllers you provide. Tab Bar Controller Introduction
  • 58. • Quickly navigate within an app • Get an understanding of the app’s layout Purpose
  • 59. • Tab bars are implemented in the UITabBar class • Tab bar items are implemented in the UITabBarItem class Implementation
  • 60. • The manager for a tab bar interface is a tab bar controller object. • The tab bar controller creates and manages tab bar view and also manages view controllers that provide content view for each mode. • Each content view controller is designated as the view controller for one of the tabs in the tab bar view. • When a tab is tapped by the user, the tab bar controller object selects the tab and displays the view associated with corresponding content view controller. Anatomy of Tab Bar
  • 61. Anatomy of Tab Bar Interface “Favorites”
 bar item “Favorites”
 view controller Tab bar Tab bar tabBarItem “Search”
 view controller “Featured” view controller Tab bar controller NSArray viewControllers Tab bar tabBarItem
  • 62. • You can customize appearance of a tab bar by setting the properties depicted below: Customizing Tab Bars Appearance • UITabBarItem = Title + Image (System Item) • Each view controller comes with a tab bar item for customizing
  • 63. • Creating a tab bar interface using storyboard • Creating a tab bar interface programmatically • Creating a tab bar item programmatically • Displaying more tab bar items • Changing the tab’s badge Working with Tab Bar
  • 64. • Drag a tab bar controller from the library. • Interface Builder creates a tab bar controller and two view controllers, and it creates relationships between them. • These relationships identify each of the newly created view controllers as the view controller for one tab of the tab bar controller. • Display it as the first view controller by selecting the option “Is Initial View Controller” in the Attributes inspector Creating a Tab Bar Interface Using Storyboard 1 2 3 4
  • 65. • Create a new UITabBarController object Creating a Tab Bar Interface Programmatically tabBarController = [[UITabBarController alloc] init]; 1
  • 66. • Create a new UITabBarController object • Create a content view controller for each tab Creating a Tab Bar Interface Programmatically MyViewController *vc1 = [[MyViewController alloc] init]; MyOtherViewController *vc2 = [[MyOtherViewController alloc] init]; 1 2
  • 67. • Create a new UITabBarController object • Create a content view controller for each tab • Add the view controllers to an array and assign that array to your tab bar controller’s viewControllers property Creating a Tab Bar Interface Programmatically NSArray* controllers = [NSArray arrayWithObjects:vc1, vc2, nil]; tabBarController.viewControllers = controllers; 1 2 3
  • 68. • Create a new UITabBarController object • Create a content view controller for each tab • Add the view controllers to an array and assign that array to your tab bar controller’s viewControllers property • Set the tab bar controller as the root view controller of your window Creating a Tab Bar Interface Programmatically window.rootViewController = tabBarController; 1 2 3 4
  • 69. Creating a Tab Bar Interface Programmatically - (void)applicationDidFinishLaunching:(UIApplication *)application { // Create a tab bar controller tabBarController = [[UITabBarController alloc] init]; ! // Create content view controller for each tab MyViewController *vc1 = [[MyViewController alloc] init]; MyOtherViewController *vc2 = [[MyOtherViewController alloc] init]; // Set the array of view controllers NSArray* controllers = [NSArray arrayWithObjects:vc1, vc2, nil]; tabBarController.viewControllers = controllers; // Add the tab bar controller’s view to the window window.rootViewController = tabBarController; }
  • 70. • Custom item with title and image: Creating a Tab Bar Item Programmatically self.tabBarItem = [[UITabBarItem alloc] initWithTitle:@"Footprints" image:[UIImage imageNamed:@"footprints.png"] tag:0];
  • 71. • Custom item with title and image: • System item: Creating a Tab Bar Item Programmatically self.tabBarItem = [[UITabBarItem alloc]initWithTabBarSystemItem: UITabBarSystemItemContacts tag:0];
  • 72. • When there are more than four tab bar items, you must you More view controller. • If you use the storyboard to create tab bar items, Xcode will automatically add More view controller in the tab bar. • Purpose of More view controller: • Choose more tab bar item • Rearrange the tab bar item Displaying More Tab Bar Items
  • 73. Creating a Tab Bar Interface Programmatically
  • 74. Creating a Tab Bar Interface Programmatically
  • 75. Creating a Tab Bar Interface Programmatically
  • 76. • A badge is a small red marker displayed in the corner of the tab. Inside the badge is some custom text that you provide. • Typically, badges contain numerical values reflecting the number of new items available on the tab, but you can also specify very short character strings too. Changing Tab’s Badge NSString *value = self.badgeField.text; self.tabBarItem.badgeValue = value;
  • 79. UIKit User Interface Catalog https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/UIKitUICatalog/index.html UIKit Transition Guide https://developer.apple.com/library/ios/documentation/UserExperience/Conceptual/TransitionGuide/index.html Asset Catalog Help https://developer.apple.com/library/ios/recipes/xcode_help-image_catalog-1.0/Recipe.html View Controller Catalog for iOS https://developer.apple.com/library/ios/documentation/WindowsViews/Conceptual/ViewControllerCatalog/ Introduction.html Documentation
  • 81. Next: Working with Table View and Search Bar