SlideShare une entreprise Scribd logo
1  sur  25
1/82
2/82
Designing with a UIToolBarDesigning with a UIToolBar
iPhone/iPad, iOS Development Tutorial
2
3/82
UINavigation ControllerUINavigation Controller
• The UINavigationController maintains a UIToolBar for
each view controller in its stack.
• This toolbar is normally hidden, but we can place
buttons on it and display it any time we want.
3
4/82
Open a new “Single View” appOpen a new “Single View” app
• Start Xcode, choose “Create a new Xcode
project,” select the Single View Application
template, and click Next.
• Select “Use Auto Reference Counting”
• Don’t select the storyboard. Don’t really need it for
this application.
• Select ‘iPhone’ as the app type
4
5/82
Add a new ClassAdd a new Class
• Select the Objective-C class template, click Next
• Name the class MainViewController.
• Make sure that the class is a subclass of
UIViewController and also create a XIB file for the
controller’s view as shown:
5
6/82
Create: MainViewControllerCreate: MainViewController
6
7/82
Edit AppDelegate.hEdit AppDelegate.h
• Now we’re going to set up a navigation controller
having a MainViewController object as its root view
controller.
• Select the AppDelegate.h file, and add the two
properties for the UINavigationController and the
MainViewController as shown on the next slide.
7
8/82
Add 2 properties + headerAdd 2 properties + header
#import "MainViewController.h“
@property (strong, nonatomic) UINavigationController
*navController;
@property (strong, nonatomic) MainViewController
*rootViewController;
8
9/82
Edit: AppDelegate.mEdit: AppDelegate.m
First synthesize our properties:
@synthesize navController = _navController;
@synthesize rootViewController = _rootViewController;
9
10/82
Edit: AppDelegate.mEdit: AppDelegate.m
• Change the didFinishLaunchingWithOptions:
method
• It’s the only method we will be making changes to.
• Leave the remaining methods in place.
10
11/82
didFinishLaunchingWithOptionsdidFinishLaunchingWithOptions
- (BOOL)application:(UIApplication *)application
didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen
mainScreen] bounds]];
// Override point for customization after application
launch.
self.rootViewController = [[MainViewController alloc]
initWithNibName:nil bundle:nil];
self.rootViewController.title = @"Main View";
self.navController = [[UINavigationController alloc]
initWithRootViewController:self.rootViewController];
[self.window addSubview:self.navController.view];
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
return YES;
}
11
12/82
What are we doing?What are we doing?
• First, we allocate and initialize the rootViewController.
• The nib name of nil in this case directs the compiler to
associate this controller with the XIB file that was
created with it (MainViewController.xib).
• A bundle of nil directs the compiler to use this
application’s bundle.
• After we initialize this controller, we set its title to
@”Main View.” This title will appear in the navigation
bar for this view controller.
12
13/82
navController ObjectnavController Object
• Next, we set up the navController object.
• We make rootViewController this object’s Root View
Controller.
• Adding the navController’s view to the main window
as a subview, we then make the main window key
and visible, and we’re off and running.
13
14/82
MainViewController.xibMainViewController.xib
14
15/82
@”Main View”@”Main View”
• Since the view
controller’s title
property was set to
@”Main View” in the
AppDelegate, that title
will appear at the top
of the interface when
we run the app:
15
16/82
MainViewController.mMainViewController.m
• Open the MainViewController.m file, and make
these additions to initWithNibName:
bundle.
16
17/82
- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
if (self) {
// set up the nav bar button:
UIBarButtonItem *btnShow = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemSearch target:self
action:@selector(toggleToolBar)];
self.navigationItem.rightBarButtonItems = [NSArray arrayWithObjects:btnShow,
nil];
// set up the tool bar buttons:
UIBarButtonItem *btnRed = [[UIBarButtonItem alloc] initWithTitle:@"Red"
style:UIBarButtonItemStyleDone target:self action:@selector(btnRedTouched)];
UIBarButtonItem *btnBlue = [[UIBarButtonItem alloc] initWithTitle:@"Blue"
style:UIBarButtonItemStyleDone target:self action:@selector(btnBlueTouched)];
UIBarButtonItem *spacer = [[UIBarButtonItem alloc]
initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil
action:nil];
UIBarButtonItem *btnGreen = [[UIBarButtonItem alloc] initWithTitle:@"Green"
style:UIBarButtonItemStyleDone target:self action:@selector(btnGreenTouched)];
self.toolbarItems = [NSArray arrayWithObjects:btnRed, btnBlue, spacer,
btnGreen, nil];
}
return self;
}
17
18/82
What did we do?What did we do?• We add a UIBarButtonSystemItemSearch button to the navigationItem’s
rightBarButtonItems array.
• This button will be placed at the right of the top navigation bar. Next, we set
up three bar buttons (btnRed, btnBlue, and btnGreen) and a spacer.
• The three buttons each have a selector, these will be defined shortly. Each
also is initialized with a title, and a style of UIBarButtonItemStyleDone, which will
produce a button with a blue background and white bolded text.
18
19/82
What did we do?What did we do?
• The function of the spacer is to add “flexible
space” between btnBlue and btnGreen.
• Flexible space will act as a “spring” between
the two buttons, pushing btnGreen all the
way to the right of the tool bar.
• Since this space is invisible, it makes no sense
to assign it an action method, so we have
set both the target and action of this object
to nil.
19
20/82
What did we do?What did we do?
• Now that we have the buttons, we need to add
them to the tool bar.
• Each view controller has it’s own toolBarItems
property, which is an NSArray of UIBarButtonItem
objects.
• We stuffed the toolBarButtons array with the three
buttons and the spacer.
20
21/82
Add to: MainViewController.mAdd to: MainViewController.m
• The last step…
• Implement the four methods we set as actions in
the buttons as shown in the code on the next slide.
21
22/82
- (void)toggleToolBar
{
BOOL barState = self.navigationController.toolbarHidden;
[self.navigationController setToolbarHidden:!barState
animated:YES];
}
- (void)btnRedTouched
{
self.view.backgroundColor = [UIColor redColor];
}
- (void)btnBlueTouched
{
self.view.backgroundColor = [UIColor cyanColor];
}
- (void)btnGreenTouched
{
self.view.backgroundColor = [UIColor greenColor];
}
22
23/82
What did we do?What did we do?
• toggleToolBar gets the hidden property of the tool
bar, then sets that property to its negation. In other
words, if the tool bar is hidden it will be shown, if it is
shown it will be hidden.
• The three btn…Touched methods set the color of
the view’s background to red, cyan, or green when
they are touched.
23
24/82
Program OutputProgram Output
24
25/82
ThankThank You !!!You !!!
For More Information click below link:
Follow Us on:
http://vibranttechnologies.co.in/ios-classes-in-mumbai.html

Contenu connexe

Tendances

Deep diving into building lightning components
Deep diving into building lightning componentsDeep diving into building lightning components
Deep diving into building lightning componentsCloud Analogy
 
android activity
android activityandroid activity
android activityDeepa Rani
 
Build your first android mobile app
Build your first android mobile appBuild your first android mobile app
Build your first android mobile appekipaco
 
Android lifecycle
Android lifecycleAndroid lifecycle
Android lifecycleKumar
 
Android | Android Activity Launch Modes and Tasks | Gonçalo Silva
Android | Android Activity Launch Modes and Tasks | Gonçalo SilvaAndroid | Android Activity Launch Modes and Tasks | Gonçalo Silva
Android | Android Activity Launch Modes and Tasks | Gonçalo SilvaJAX London
 
Getting Started with Developing for the Apple Watch
Getting Started with Developing for the Apple WatchGetting Started with Developing for the Apple Watch
Getting Started with Developing for the Apple WatchMurtza Manzur
 
Android activity
Android activityAndroid activity
Android activityKrazy Koder
 
Unity Google VR Cardboard Deployment on iOS and Android
Unity Google VR Cardboard Deployment on iOS and AndroidUnity Google VR Cardboard Deployment on iOS and Android
Unity Google VR Cardboard Deployment on iOS and AndroidKobkrit Viriyayudhakorn
 
04 activities - Android
04   activities - Android04   activities - Android
04 activities - AndroidWingston
 
[Made Easy] How to use IFTT - Tutorial
[Made Easy] How to use IFTT - Tutorial[Made Easy] How to use IFTT - Tutorial
[Made Easy] How to use IFTT - TutorialEdison Villareal
 
08.1. Android How to Use Intent (explicit)
08.1. Android How to Use Intent (explicit)08.1. Android How to Use Intent (explicit)
08.1. Android How to Use Intent (explicit)Oum Saokosal
 
Getting Started With Developing For Apple Watch
Getting Started With Developing For Apple WatchGetting Started With Developing For Apple Watch
Getting Started With Developing For Apple WatchInMobi
 
iPhone Development Tools
iPhone Development ToolsiPhone Development Tools
iPhone Development ToolsOmar Cafini
 
Adopting 3D Touch in your apps
Adopting 3D Touch in your appsAdopting 3D Touch in your apps
Adopting 3D Touch in your appsJuan C Catalan
 
ITS488 Lecture 4: Google VR Cardboard Game Development: Basket Ball Game #2
ITS488 Lecture 4: Google VR Cardboard Game Development: Basket Ball Game #2ITS488 Lecture 4: Google VR Cardboard Game Development: Basket Ball Game #2
ITS488 Lecture 4: Google VR Cardboard Game Development: Basket Ball Game #2Kobkrit Viriyayudhakorn
 
Android tutorial (2)
Android tutorial (2)Android tutorial (2)
Android tutorial (2)Kumar
 

Tendances (20)

Mule java part-2
Mule java part-2Mule java part-2
Mule java part-2
 
Deep diving into building lightning components
Deep diving into building lightning componentsDeep diving into building lightning components
Deep diving into building lightning components
 
android activity
android activityandroid activity
android activity
 
React-Native Lecture 11: In App Storage
React-Native Lecture 11: In App StorageReact-Native Lecture 11: In App Storage
React-Native Lecture 11: In App Storage
 
Build your first android mobile app
Build your first android mobile appBuild your first android mobile app
Build your first android mobile app
 
Android lifecycle
Android lifecycleAndroid lifecycle
Android lifecycle
 
Android | Android Activity Launch Modes and Tasks | Gonçalo Silva
Android | Android Activity Launch Modes and Tasks | Gonçalo SilvaAndroid | Android Activity Launch Modes and Tasks | Gonçalo Silva
Android | Android Activity Launch Modes and Tasks | Gonçalo Silva
 
Getting Started with Developing for the Apple Watch
Getting Started with Developing for the Apple WatchGetting Started with Developing for the Apple Watch
Getting Started with Developing for the Apple Watch
 
Android activity
Android activityAndroid activity
Android activity
 
Unity Google VR Cardboard Deployment on iOS and Android
Unity Google VR Cardboard Deployment on iOS and AndroidUnity Google VR Cardboard Deployment on iOS and Android
Unity Google VR Cardboard Deployment on iOS and Android
 
04 activities - Android
04   activities - Android04   activities - Android
04 activities - Android
 
[Made Easy] How to use IFTT - Tutorial
[Made Easy] How to use IFTT - Tutorial[Made Easy] How to use IFTT - Tutorial
[Made Easy] How to use IFTT - Tutorial
 
08.1. Android How to Use Intent (explicit)
08.1. Android How to Use Intent (explicit)08.1. Android How to Use Intent (explicit)
08.1. Android How to Use Intent (explicit)
 
Getting Started With Developing For Apple Watch
Getting Started With Developing For Apple WatchGetting Started With Developing For Apple Watch
Getting Started With Developing For Apple Watch
 
iPhone Development Tools
iPhone Development ToolsiPhone Development Tools
iPhone Development Tools
 
Adopting 3D Touch in your apps
Adopting 3D Touch in your appsAdopting 3D Touch in your apps
Adopting 3D Touch in your apps
 
Ios - Introduction to memory management
Ios - Introduction to memory managementIos - Introduction to memory management
Ios - Introduction to memory management
 
ITS488 Lecture 4: Google VR Cardboard Game Development: Basket Ball Game #2
ITS488 Lecture 4: Google VR Cardboard Game Development: Basket Ball Game #2ITS488 Lecture 4: Google VR Cardboard Game Development: Basket Ball Game #2
ITS488 Lecture 4: Google VR Cardboard Game Development: Basket Ball Game #2
 
Android tutorial (2)
Android tutorial (2)Android tutorial (2)
Android tutorial (2)
 
Let's do SPA
Let's do SPALet's do SPA
Let's do SPA
 

En vedette (12)

Android - Api & Debugging in Android
Android - Api & Debugging in AndroidAndroid - Api & Debugging in Android
Android - Api & Debugging in Android
 
Android - Android Intent Types
Android - Android Intent TypesAndroid - Android Intent Types
Android - Android Intent Types
 
Android - Android Application Fundamentals
Android - Android Application FundamentalsAndroid - Android Application Fundamentals
Android - Android Application Fundamentals
 
Android - Getting started with Android
Android - Getting started with Android Android - Getting started with Android
Android - Getting started with Android
 
Android - Anatomy of android elements & layouts
Android - Anatomy of android elements & layoutsAndroid - Anatomy of android elements & layouts
Android - Anatomy of android elements & layouts
 
Ios - Introduction to platform & SDK
Ios - Introduction to platform & SDKIos - Introduction to platform & SDK
Ios - Introduction to platform & SDK
 
Weblogic - overview of application server
Weblogic - overview of application serverWeblogic - overview of application server
Weblogic - overview of application server
 
Android - Anroid Pproject
Android - Anroid PprojectAndroid - Anroid Pproject
Android - Anroid Pproject
 
Android - Android Geocoding and Location based Services
Android - Android Geocoding and Location based ServicesAndroid - Android Geocoding and Location based Services
Android - Android Geocoding and Location based Services
 
Ios - Introduction to swift programming
Ios - Introduction to swift programmingIos - Introduction to swift programming
Ios - Introduction to swift programming
 
Android - Graphics Animation in Android
Android - Graphics Animation in AndroidAndroid - Graphics Animation in Android
Android - Graphics Animation in Android
 
Ios - Intorduction to view controller
Ios - Intorduction to view controllerIos - Intorduction to view controller
Ios - Intorduction to view controller
 

Similaire à IOS- Designing with ui tool bar in ios

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
 
iOS Development: What's New
iOS Development: What's NewiOS Development: What's New
iOS Development: What's NewNascentDigital
 
Alloy Simple App Demonstration
Alloy Simple App DemonstrationAlloy Simple App Demonstration
Alloy Simple App DemonstrationAaron Saunders
 
What is ui element in i phone developmetn
What is ui element in i phone developmetnWhat is ui element in i phone developmetn
What is ui element in i phone developmetnTOPS Technologies
 
Building your first iOS app using Xamarin
Building your first iOS app using XamarinBuilding your first iOS app using Xamarin
Building your first iOS app using XamarinGill Cleeren
 
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 OverviewSammy Sunny
 
iOS Contact List Application Tutorial
iOS Contact List Application TutorialiOS Contact List Application Tutorial
iOS Contact List Application TutorialIshara Amarasekera
 
I pad uicatalog_lesson02
I pad uicatalog_lesson02I pad uicatalog_lesson02
I pad uicatalog_lesson02Rich Helton
 
Creating simple comp
Creating simple compCreating simple comp
Creating simple compKranthi Kumar
 
Google calendar integration in iOS app
Google calendar integration in iOS appGoogle calendar integration in iOS app
Google calendar integration in iOS appKetan Raval
 
Assignment 4 Paparazzi1
Assignment 4 Paparazzi1Assignment 4 Paparazzi1
Assignment 4 Paparazzi1Mahmoud
 
Ios actions and outlets
Ios actions and outletsIos actions and outlets
Ios actions and outletsveeracynixit
 
Ios actions and outlets
Ios actions and outletsIos actions and outlets
Ios actions and outletsveeracynixit
 
Swift Tableview iOS App Development
Swift Tableview iOS App DevelopmentSwift Tableview iOS App Development
Swift Tableview iOS App DevelopmentKetan Raval
 
iPhone Programming [7/17] : Behind the Scene
iPhone Programming [7/17] : Behind the SceneiPhone Programming [7/17] : Behind the Scene
iPhone Programming [7/17] : Behind the SceneIMC Institute
 

Similaire à IOS- Designing with ui tool bar in ios (20)

Introduction of Xcode
Introduction of XcodeIntroduction of Xcode
Introduction of Xcode
 
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)
 
iOS: View Controllers
iOS: View ControllersiOS: View Controllers
iOS: View Controllers
 
iOS Development: What's New
iOS Development: What's NewiOS Development: What's New
iOS Development: What's New
 
Alloy Simple App Demonstration
Alloy Simple App DemonstrationAlloy Simple App Demonstration
Alloy Simple App Demonstration
 
IOS Storyboards
IOS StoryboardsIOS Storyboards
IOS Storyboards
 
What is ui element in i phone developmetn
What is ui element in i phone developmetnWhat is ui element in i phone developmetn
What is ui element in i phone developmetn
 
Building your first iOS app using Xamarin
Building your first iOS app using XamarinBuilding your first iOS app using Xamarin
Building your first iOS app using Xamarin
 
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
 
iOS Contact List Application Tutorial
iOS Contact List Application TutorialiOS Contact List Application Tutorial
iOS Contact List Application Tutorial
 
I pad uicatalog_lesson02
I pad uicatalog_lesson02I pad uicatalog_lesson02
I pad uicatalog_lesson02
 
Creating a comp
Creating a compCreating a comp
Creating a comp
 
Creating simple comp
Creating simple compCreating simple comp
Creating simple comp
 
Google calendar integration in iOS app
Google calendar integration in iOS appGoogle calendar integration in iOS app
Google calendar integration in iOS app
 
Assignment 4 Paparazzi1
Assignment 4 Paparazzi1Assignment 4 Paparazzi1
Assignment 4 Paparazzi1
 
Ios actions and outlets
Ios actions and outletsIos actions and outlets
Ios actions and outlets
 
Ios actions and outlets
Ios actions and outletsIos actions and outlets
Ios actions and outlets
 
Swift Tableview iOS App Development
Swift Tableview iOS App DevelopmentSwift Tableview iOS App Development
Swift Tableview iOS App Development
 
iPhone Programming [7/17] : Behind the Scene
iPhone Programming [7/17] : Behind the SceneiPhone Programming [7/17] : Behind the Scene
iPhone Programming [7/17] : Behind the Scene
 
Project anatomy & hello world
Project anatomy & hello worldProject anatomy & hello world
Project anatomy & hello world
 

Plus de Vibrant Technologies & Computers

Data ware housing - Introduction to data ware housing process.
Data ware housing - Introduction to data ware housing process.Data ware housing - Introduction to data ware housing process.
Data ware housing - Introduction to data ware housing process.Vibrant Technologies & Computers
 

Plus de Vibrant Technologies & Computers (20)

Buisness analyst business analysis overview ppt 5
Buisness analyst business analysis overview ppt 5Buisness analyst business analysis overview ppt 5
Buisness analyst business analysis overview ppt 5
 
SQL Introduction to displaying data from multiple tables
SQL Introduction to displaying data from multiple tables  SQL Introduction to displaying data from multiple tables
SQL Introduction to displaying data from multiple tables
 
SQL- Introduction to MySQL
SQL- Introduction to MySQLSQL- Introduction to MySQL
SQL- Introduction to MySQL
 
SQL- Introduction to SQL database
SQL- Introduction to SQL database SQL- Introduction to SQL database
SQL- Introduction to SQL database
 
ITIL - introduction to ITIL
ITIL - introduction to ITILITIL - introduction to ITIL
ITIL - introduction to ITIL
 
Salesforce - Introduction to Security & Access
Salesforce -  Introduction to Security & Access Salesforce -  Introduction to Security & Access
Salesforce - Introduction to Security & Access
 
Data ware housing- Introduction to olap .
Data ware housing- Introduction to  olap .Data ware housing- Introduction to  olap .
Data ware housing- Introduction to olap .
 
Data ware housing - Introduction to data ware housing process.
Data ware housing - Introduction to data ware housing process.Data ware housing - Introduction to data ware housing process.
Data ware housing - Introduction to data ware housing process.
 
Data ware housing- Introduction to data ware housing
Data ware housing- Introduction to data ware housingData ware housing- Introduction to data ware housing
Data ware housing- Introduction to data ware housing
 
Salesforce - classification of cloud computing
Salesforce - classification of cloud computingSalesforce - classification of cloud computing
Salesforce - classification of cloud computing
 
Salesforce - cloud computing fundamental
Salesforce - cloud computing fundamentalSalesforce - cloud computing fundamental
Salesforce - cloud computing fundamental
 
SQL- Introduction to PL/SQL
SQL- Introduction to  PL/SQLSQL- Introduction to  PL/SQL
SQL- Introduction to PL/SQL
 
SQL- Introduction to advanced sql concepts
SQL- Introduction to  advanced sql conceptsSQL- Introduction to  advanced sql concepts
SQL- Introduction to advanced sql concepts
 
SQL Inteoduction to SQL manipulating of data
SQL Inteoduction to SQL manipulating of data   SQL Inteoduction to SQL manipulating of data
SQL Inteoduction to SQL manipulating of data
 
SQL- Introduction to SQL Set Operations
SQL- Introduction to SQL Set OperationsSQL- Introduction to SQL Set Operations
SQL- Introduction to SQL Set Operations
 
Sas - Introduction to designing the data mart
Sas - Introduction to designing the data martSas - Introduction to designing the data mart
Sas - Introduction to designing the data mart
 
Sas - Introduction to working under change management
Sas - Introduction to working under change managementSas - Introduction to working under change management
Sas - Introduction to working under change management
 
SAS - overview of SAS
SAS - overview of SASSAS - overview of SAS
SAS - overview of SAS
 
Teradata - Architecture of Teradata
Teradata - Architecture of TeradataTeradata - Architecture of Teradata
Teradata - Architecture of Teradata
 
Teradata - Restoring Data
Teradata - Restoring Data Teradata - Restoring Data
Teradata - Restoring Data
 

Dernier

A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbuapidays
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...Zilliz
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...apidays
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProduct Anonymous
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesrafiqahmad00786416
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Zilliz
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024The Digital Insurer
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Miguel Araújo
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherRemote DBA Services
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoffsammart93
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Jeffrey Haguewood
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyKhushali Kathiriya
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobeapidays
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...DianaGray10
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc
 

Dernier (20)

A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu SubbuApidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
Apidays Singapore 2024 - Modernizing Securities Finance by Madhu Subbu
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
ICT role in 21st century education and its challenges
ICT role in 21st century education and its challengesICT role in 21st century education and its challenges
ICT role in 21st century education and its challenges
 
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
Emergent Methods: Multi-lingual narrative tracking in the news - real-time ex...
 
Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024Manulife - Insurer Transformation Award 2024
Manulife - Insurer Transformation Award 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
Web Form Automation for Bonterra Impact Management (fka Social Solutions Apri...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 

IOS- Designing with ui tool bar in ios

  • 2. 2/82 Designing with a UIToolBarDesigning with a UIToolBar iPhone/iPad, iOS Development Tutorial 2
  • 3. 3/82 UINavigation ControllerUINavigation Controller • The UINavigationController maintains a UIToolBar for each view controller in its stack. • This toolbar is normally hidden, but we can place buttons on it and display it any time we want. 3
  • 4. 4/82 Open a new “Single View” appOpen a new “Single View” app • Start Xcode, choose “Create a new Xcode project,” select the Single View Application template, and click Next. • Select “Use Auto Reference Counting” • Don’t select the storyboard. Don’t really need it for this application. • Select ‘iPhone’ as the app type 4
  • 5. 5/82 Add a new ClassAdd a new Class • Select the Objective-C class template, click Next • Name the class MainViewController. • Make sure that the class is a subclass of UIViewController and also create a XIB file for the controller’s view as shown: 5
  • 7. 7/82 Edit AppDelegate.hEdit AppDelegate.h • Now we’re going to set up a navigation controller having a MainViewController object as its root view controller. • Select the AppDelegate.h file, and add the two properties for the UINavigationController and the MainViewController as shown on the next slide. 7
  • 8. 8/82 Add 2 properties + headerAdd 2 properties + header #import "MainViewController.h“ @property (strong, nonatomic) UINavigationController *navController; @property (strong, nonatomic) MainViewController *rootViewController; 8
  • 9. 9/82 Edit: AppDelegate.mEdit: AppDelegate.m First synthesize our properties: @synthesize navController = _navController; @synthesize rootViewController = _rootViewController; 9
  • 10. 10/82 Edit: AppDelegate.mEdit: AppDelegate.m • Change the didFinishLaunchingWithOptions: method • It’s the only method we will be making changes to. • Leave the remaining methods in place. 10
  • 11. 11/82 didFinishLaunchingWithOptionsdidFinishLaunchingWithOptions - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // Override point for customization after application launch. self.rootViewController = [[MainViewController alloc] initWithNibName:nil bundle:nil]; self.rootViewController.title = @"Main View"; self.navController = [[UINavigationController alloc] initWithRootViewController:self.rootViewController]; [self.window addSubview:self.navController.view]; self.window.backgroundColor = [UIColor whiteColor]; [self.window makeKeyAndVisible]; return YES; } 11
  • 12. 12/82 What are we doing?What are we doing? • First, we allocate and initialize the rootViewController. • The nib name of nil in this case directs the compiler to associate this controller with the XIB file that was created with it (MainViewController.xib). • A bundle of nil directs the compiler to use this application’s bundle. • After we initialize this controller, we set its title to @”Main View.” This title will appear in the navigation bar for this view controller. 12
  • 13. 13/82 navController ObjectnavController Object • Next, we set up the navController object. • We make rootViewController this object’s Root View Controller. • Adding the navController’s view to the main window as a subview, we then make the main window key and visible, and we’re off and running. 13
  • 15. 15/82 @”Main View”@”Main View” • Since the view controller’s title property was set to @”Main View” in the AppDelegate, that title will appear at the top of the interface when we run the app: 15
  • 16. 16/82 MainViewController.mMainViewController.m • Open the MainViewController.m file, and make these additions to initWithNibName: bundle. 16
  • 17. 17/82 - (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil { self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil]; if (self) { // set up the nav bar button: UIBarButtonItem *btnShow = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemSearch target:self action:@selector(toggleToolBar)]; self.navigationItem.rightBarButtonItems = [NSArray arrayWithObjects:btnShow, nil]; // set up the tool bar buttons: UIBarButtonItem *btnRed = [[UIBarButtonItem alloc] initWithTitle:@"Red" style:UIBarButtonItemStyleDone target:self action:@selector(btnRedTouched)]; UIBarButtonItem *btnBlue = [[UIBarButtonItem alloc] initWithTitle:@"Blue" style:UIBarButtonItemStyleDone target:self action:@selector(btnBlueTouched)]; UIBarButtonItem *spacer = [[UIBarButtonItem alloc] initWithBarButtonSystemItem:UIBarButtonSystemItemFlexibleSpace target:nil action:nil]; UIBarButtonItem *btnGreen = [[UIBarButtonItem alloc] initWithTitle:@"Green" style:UIBarButtonItemStyleDone target:self action:@selector(btnGreenTouched)]; self.toolbarItems = [NSArray arrayWithObjects:btnRed, btnBlue, spacer, btnGreen, nil]; } return self; } 17
  • 18. 18/82 What did we do?What did we do?• We add a UIBarButtonSystemItemSearch button to the navigationItem’s rightBarButtonItems array. • This button will be placed at the right of the top navigation bar. Next, we set up three bar buttons (btnRed, btnBlue, and btnGreen) and a spacer. • The three buttons each have a selector, these will be defined shortly. Each also is initialized with a title, and a style of UIBarButtonItemStyleDone, which will produce a button with a blue background and white bolded text. 18
  • 19. 19/82 What did we do?What did we do? • The function of the spacer is to add “flexible space” between btnBlue and btnGreen. • Flexible space will act as a “spring” between the two buttons, pushing btnGreen all the way to the right of the tool bar. • Since this space is invisible, it makes no sense to assign it an action method, so we have set both the target and action of this object to nil. 19
  • 20. 20/82 What did we do?What did we do? • Now that we have the buttons, we need to add them to the tool bar. • Each view controller has it’s own toolBarItems property, which is an NSArray of UIBarButtonItem objects. • We stuffed the toolBarButtons array with the three buttons and the spacer. 20
  • 21. 21/82 Add to: MainViewController.mAdd to: MainViewController.m • The last step… • Implement the four methods we set as actions in the buttons as shown in the code on the next slide. 21
  • 22. 22/82 - (void)toggleToolBar { BOOL barState = self.navigationController.toolbarHidden; [self.navigationController setToolbarHidden:!barState animated:YES]; } - (void)btnRedTouched { self.view.backgroundColor = [UIColor redColor]; } - (void)btnBlueTouched { self.view.backgroundColor = [UIColor cyanColor]; } - (void)btnGreenTouched { self.view.backgroundColor = [UIColor greenColor]; } 22
  • 23. 23/82 What did we do?What did we do? • toggleToolBar gets the hidden property of the tool bar, then sets that property to its negation. In other words, if the tool bar is hidden it will be shown, if it is shown it will be hidden. • The three btn…Touched methods set the color of the view’s background to red, cyan, or green when they are touched. 23
  • 25. 25/82 ThankThank You !!!You !!! For More Information click below link: Follow Us on: http://vibranttechnologies.co.in/ios-classes-in-mumbai.html