SlideShare a Scribd company logo
1/82
2/82
The Platform and SDK
3/82
iOS
iPhone iPad Mini
iPad
4/82
Market share
Market Share 2012
Second mobile OS in usage
First mobile OS in revenue
First mobile OS in internet traffic
5/82
+ Highest revenue for mobile OS
+ Little fragmentation (just iPhone and iPad)
+ Runs on high-end devices
+ Big developer community and excellent support
+ Many open-source libraries available
- Strictly controlled by Apple
- Development only possible in Mac OS
- Objective C is the main programming language
iOS: Advantages and disadvantages
6/82
Technology
Application development in Objective C – a language that
adds Smalltalk-style messaging to C
Development done in Xcode on Mac OS devices
Debugging and running on phone done also in Xcode
7/82
Installing development kit
Install Xcode IDE – newest version 4.6.1
Installing Xcode automatically installs iOS SDK
Xcode is free to download from Mac App store
8/82
Apple developer program
Apple developer account is free
Apple developer program is not free – 99$/year
Registration done from https://developer.apple.com/programs/ios/
Registration process takes 3-5 days
9/82
iOS development
1010
1010
Develop
No cost
Debug
Potential cost
1010
1010
Deploy
Requires Developer
Program
Test
Requires Developer
Program
10/82
iOS debugging
1010
1010
Develop
1010
1010 Simulator does not require
a developer program
Debug
1010
1010
Device requires a Developer
Provisioning Profile – 99$/year
11/82
App Store / Marketplace
summary
iOS Android Windows Phone
Approval Process Yes No Yes
Distribution outside the store No Yes No
Fragmentation Very Little Yes Yes
Multiple stores / Marketplaces No Yes No
12/82
Objective-C is an object oriented language
Follows ANSI C style coding with methods from Smalltalk
Flexible because almost everything is done at runtime:
•Dynamic Binding
•Dynamic Typing
•Dynamic Linking
It is used for both iOS and Mac OS development
Source files: .m, header files: .h
Has protocols, which work like interfaces in Java they specify a number of methods
a class must implement
Objective C
13/82
Almost every object manipulation is done by sending objects a message
Two words within a set of brackets, the object identifier and the message to send:
[self.mainLabel setText:[self.mainTextInput text]];
Dot syntax:
self.mainLabel.text = self.mainTextInput.text;
Equivalent to C++ or Java’s:
this.mainLabel.setText( this.mainTextInput.text() );
Static methods start with +, instance methods with -:
+(id)defaultController vs. -(void)initLocationManager
Messages
14/82
A collection of libraries developed by Apple to aid GUI development
Has a set of predefined classes and types such as NSNumber, NSString, NSDate
(NS stands for NeXT-sun)
Includes a root class NSObject where keywords like alloc, retain, and release come
from
Apple Human Interface Guidelines:
http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/Mobile
Cocoa API
15/82
Objects are created dynamically using alloc keyword
Objects are automatically deallocated in latest Objective-C through automatic
reference counting (ARC)
ARC keeps an internal count of how many times an Object is 'needed'
System makes sure that objects that are needed are not deleted, and when an
object is not needed it is deleted
Memory allocation
16/82
C++ vs. Objective-C
C++ Objective C
Adds OOP, metaprogramming
and generic programming to C
Only adds OOP to C
Comes with a std library Has no standard library; is
dependant on other libraries
Has numerous uses Mostly used for application
building
Large and complex code for OOP Simpler way of handling classes
and objects
17/82
Hello world example
18/82
Hello World
Task: “Change a label’s text using a button and an input box.”
Create a new empty project:
19/82
New Project
Name the project and check “Use Core Data” and
“User Automatic Reference Counting”
20/82
New Project
Create the project and also create local git
repository for source control
21/82
Create interface
Create a new storyboard file
Empty storyboard will be created
22/82
Creating main screen
Click on the storyboard
Create a navigation controller from the
storyboard designer by drag and drop
23/82
Delete default screen
Delete the default Table View Controller and add your own
View Controller by drag and drop
Right click from the navigation controller to View
Controller and choose root view controller relationship
24/82
Add items to screen
Add items to screen by using drag and drop:
label, button and text edit
Attention!
Disable “Use Autolayout” from
View Controller properties if you
want application to work in iOS 5
and earlier
25/82
Create a class for the screen
The class should subclass UiViewController
26/82
Connect your class to the storyboard
Make the View Controller in the storyboard to be you class
Open Assistant editor
Drag and drop interface objects to you class h file to create connections
27/82
Add an action to the button
Right click on the button
Choose “Touch Up Inside” and drag and
drop to the h file
Name the method that will be executed
when button is touched
28/82
Add an action to the button
Name the method that will be executed when
button is touched
29/82
Header file will look like this:
#import <UIKit/UIKit.h>
@interface MainViewController : UIViewController
@property (strong, nonatomic) IBOutlet UIButton *mainButton;
@property (strong, nonatomic) IBOutlet UITextField
*mainTextInput;
@property (strong, nonatomic) IBOutlet UILabel *mainLabel;
- (IBAction)changeLabel:(id)sender;
@end
Change label text:
- (IBAction)changeLabel:(id)sender {
// Change the text
[self.mainLabel setText:[self.mainTextInput text]];
}
Source files
30/82
Prepare application
- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary
*)launchOptions
{
self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]];
// Override point for customization after application launch.
self.window.backgroundColor = [UIColor whiteColor];
[self.window makeKeyAndVisible];
return YES;
}
Delete the gray bold text from didFinishLaunchingWithOptions
Go to the auto-generated AppDelegate file and include your own Ui class
31/82
Run the applicationGo to project properties and set your storyboard as Main Storyboard
Press run in simulator
32/82
Run the application on phone
Open the organizer
Log in with your
developer id
You need to be enroller
in developer program
Connect the phone to the
computer
Add the device to your
provisioning portal
33/82
Maps and location
34/82
Include CoreLocation and MapKit
Go to your project properties, libraries and press to add
CoreLocation and MapKit for location and map support
By default, they are not added to your project
35/82
Adding a Map View
Add a Map View to you main screen from the designer
36/82
Displaying location on the map
Check “Shows User Location” from Map View properties
Run the application
37/82
.h file:
#import <UIKit/UIKit.h>
#import <MapKit/MapKit.h>
@interface UEFPin : NSObject <MKAnnotation>
@property (nonatomic, assign) CLLocationCoordinate2D coordinate;
@property (nonatomic, strong) NSString *title;
@property (nonatomic, strong) NSString *subtitle;
-(id)initWithCoordinate:(CLLocationCoordinate2D)location andTitle:(NSString*)aTitle;
@end
.m File:
#import "UEFPin.h"
@implementation UEFPin
@synthesize title, subtitle, coordinate;
-(id)initWithCoordinate:(CLLocationCoordinate2D)location andTitle:(NSString*)aTitle {
self = [super init];
if(self) {
self.coordinate = location;
self.title = aTitle;
}
return self;
}
@end
Show a pin on the map
Create a class which implements MKAnnotation protocol
38/82
- (void)viewDidAppear:(BOOL)animated {
[super viewDidAppear:animated];
CLLocationCoordinate2D location;
location.latitude = 62.598;
location.longitude = 29.745;
MKCoordinateRegion region;
MKCoordinateSpan span;
span.latitudeDelta=0.01;
span.longitudeDelta=0.01;
region.span=span;
region.center=location;
[mapView setDelegate:self];
[mapView addAnnotation:[[UEFPin alloc] initWithCoordinate:location andTitle:@"Joensuu Science
Park"]];
[mapView setRegion:region animated:TRUE];
[mapView regionThatFits:region];
}
Show a pin on the map
In your view controller viewDidAppear create the pin and
zoom to it
Create a location
Create a region
centered on location
Create the pin
Zoom to the region
Set self as map delegate
39/82
- (MKAnnotationView *) mapView:(MKMapView *)mapView
viewForAnnotation:(id <MKAnnotation>) annotation{
MKPinAnnotationView *annView=[[MKPinAnnotationView alloc]
initWithAnnotation:annotation reuseIdentifier:@"MapPin"];
annView.pinColor = MKPinAnnotationColorGreen;
annView.animatesDrop=YES;
annView.showsCallout=YES;
return annView;
}
Show a pin on the map
Make your view controller implement MKAnnotation
protocol and implement viewForAnnotation method
40/82
@interface LocationController : NSObject <CLLocationManagerDelegate>
// Class members: Location manager and current location container
@property (nonatomic, retain) CLLocationManager *locationManager;
@property (nonatomic, retain) CLLocation *currentLocation;
+ (id)defaultController; // Static singleton
// Init, start and stop Location Manager
- (void) initLocationManager;
- (void) startLocationManager:(CLLocationAccuracy)accuracy;
- (void) stopLocationManager;
@end
Handling locationCreate a class which implements CLLocationManagerDelegate protocol and
has a CLLocationManager object
Header file:
41/82
#import "LocationController.h"
@implementation LocationController
@synthesize locationManager, currentLocation; // Autogenerate getters and setters
+ (id)defaultController {// Static singleton
static LocationController *sharedController = nil;
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
sharedController = [[self alloc] init];
});
return sharedController;
}
- (id) init {// This will be called when instantiating object
self = [super init];
if (self != nil) {
[self initLocationManager]; // Custom init code
}
return self;
}
-(void) dealloc { // Called when deleting objects
if(self.locationManager != nil) [self.locationManager stopUpdatingLocation];
// Make sure all objects are nil so Automatic Reference Count will delete them
[self setLocationManager:nil];
[self setCurrentLocation:nil];
}
Handling location
42/82
- (void) initLocationManager {
self.locationManager = [[CLLocationManager alloc] init];
self.locationManager.delegate = self; // send loc updates to myself
currentLocation = [[CLLocation alloc] initWithLatitude:0 longitude:0];
// start location
[self startLocationManager:kCLLocationAccuracyBestForNavigation];
}
-(void) startLocationManager:(CLLocationAccuracy)accuracy {
if(self.locationManager != nil) {
self.locationManager.desiredAccuracy = accuracy;
self.locationManager.distanceFilter = 0;
self.locationManager.headingFilter = 0;
// Start location updates
if([CLLocationManager locationServicesEnabled]){
[self.locationManager startUpdatingLocation];
}
}
}
-(void) stopLocationManager {
[self.locationManager stopUpdatingLocation];
}
Handling location
43/82
// This is called when location is updated
- (void)locationManager:(CLLocationManager *)manager didUpdateToLocation:
(CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation
{
NSDate* eventDate = newLocation.timestamp;
NSTimeInterval howRecent = [eventDate timeIntervalSinceNow];
if (abs(howRecent) < 60.0)
{
//Location timestamp is within the last 60.0 seconds, let's use it!
if(newLocation.horizontalAccuracy < kMaxGpsAccuracy){
currentLocation = newLocation;;
}
}
}
Handling location
44/82
// Error handling
- (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError
*)error
{
NSString *errorString; switch([error code]) {
case kCLErrorDenied:
//Access denied by user
errorString = @"Access to Location Services denied by user“;
break;
case kCLErrorLocationUnknown:
//Probably temporary...
errorString = @"Location data unavailable“; break;
default:
errorString = @"An unknown error has occurred";
break;
}
NSLog(@"Error: %@“, errorString);
}
@end // End of class implementation
Handling location
45/82
ThankThank You !!!You !!!
For More Information click below link:
Follow Us on:
http://vibranttechnologies.co.in/ios-classes-in-mumbai.html

More Related Content

What's hot

outgoing again
outgoing againoutgoing again
outgoing again
spredslide
 
iPhone Development Tools
iPhone Development ToolsiPhone Development Tools
iPhone Development Tools
Omar Cafini
 
iPhone SDK dev sharing - the very basics
iPhone SDK dev sharing - the very basicsiPhone SDK dev sharing - the very basics
iPhone SDK dev sharing - the very basics
kenshin03
 
UIViewControllerのコーナーケース
UIViewControllerのコーナーケースUIViewControllerのコーナーケース
UIViewControllerのコーナーケース
Katsumi Kishikawa
 
Configure &amp; send push notification on i os device
Configure &amp; send push notification on i os deviceConfigure &amp; send push notification on i os device
Configure &amp; send push notification on i os device
ShepHertz
 
Android Tutorial
Android TutorialAndroid Tutorial
Android Tutorial
Fun2Do Labs
 
Android application development workshop day1
Android application development workshop   day1Android application development workshop   day1
Android application development workshop day1
Borhan Otour
 
Android application development
Android application developmentAndroid application development
Android application development
slidesuren
 
Gradle for Android Developers
Gradle for Android DevelopersGradle for Android Developers
Gradle for Android Developers
Josiah Renaudin
 
How to Build & Develop Responsive Open Learning Environments with the ROLE SDK
How to Build & Develop Responsive Open Learning Environments with the ROLE SDKHow to Build & Develop Responsive Open Learning Environments with the ROLE SDK
How to Build & Develop Responsive Open Learning Environments with the ROLE SDK
Dominik Renzel
 
Code to go Android
Code to go AndroidCode to go Android
Code to go Android
Peter van der Linden
 
Developing on Windows 8
Developing on Windows 8Developing on Windows 8
Developing on Windows 8
Einar Ingebrigtsen
 
201010 SPLASH Tutorial
201010 SPLASH Tutorial201010 SPLASH Tutorial
201010 SPLASH Tutorial
Javier Gonzalez-Sanchez
 
Introduction to android coding
Introduction to android codingIntroduction to android coding
Introduction to android coding
Hari Krishna
 
Android - From Zero to Hero @ DEVit 2017
Android - From Zero to Hero @ DEVit 2017Android - From Zero to Hero @ DEVit 2017
Android - From Zero to Hero @ DEVit 2017
Ivo Neskovic
 
What is Android?
What is Android?What is Android?
What is Android?
ndalban
 
Android programming basics
Android programming basicsAndroid programming basics
Android programming basics
Egerton University
 
L0020 - The Basic RCP Application
L0020 - The Basic RCP ApplicationL0020 - The Basic RCP Application
L0020 - The Basic RCP Application
Tonny Madsen
 
View groups containers
View groups containersView groups containers
View groups containers
Mani Selvaraj
 
Titanium appcelerator sdk
Titanium appcelerator sdkTitanium appcelerator sdk
Titanium appcelerator sdk
Alessio Ricco
 

What's hot (20)

outgoing again
outgoing againoutgoing again
outgoing again
 
iPhone Development Tools
iPhone Development ToolsiPhone Development Tools
iPhone Development Tools
 
iPhone SDK dev sharing - the very basics
iPhone SDK dev sharing - the very basicsiPhone SDK dev sharing - the very basics
iPhone SDK dev sharing - the very basics
 
UIViewControllerのコーナーケース
UIViewControllerのコーナーケースUIViewControllerのコーナーケース
UIViewControllerのコーナーケース
 
Configure &amp; send push notification on i os device
Configure &amp; send push notification on i os deviceConfigure &amp; send push notification on i os device
Configure &amp; send push notification on i os device
 
Android Tutorial
Android TutorialAndroid Tutorial
Android Tutorial
 
Android application development workshop day1
Android application development workshop   day1Android application development workshop   day1
Android application development workshop day1
 
Android application development
Android application developmentAndroid application development
Android application development
 
Gradle for Android Developers
Gradle for Android DevelopersGradle for Android Developers
Gradle for Android Developers
 
How to Build & Develop Responsive Open Learning Environments with the ROLE SDK
How to Build & Develop Responsive Open Learning Environments with the ROLE SDKHow to Build & Develop Responsive Open Learning Environments with the ROLE SDK
How to Build & Develop Responsive Open Learning Environments with the ROLE SDK
 
Code to go Android
Code to go AndroidCode to go Android
Code to go Android
 
Developing on Windows 8
Developing on Windows 8Developing on Windows 8
Developing on Windows 8
 
201010 SPLASH Tutorial
201010 SPLASH Tutorial201010 SPLASH Tutorial
201010 SPLASH Tutorial
 
Introduction to android coding
Introduction to android codingIntroduction to android coding
Introduction to android coding
 
Android - From Zero to Hero @ DEVit 2017
Android - From Zero to Hero @ DEVit 2017Android - From Zero to Hero @ DEVit 2017
Android - From Zero to Hero @ DEVit 2017
 
What is Android?
What is Android?What is Android?
What is Android?
 
Android programming basics
Android programming basicsAndroid programming basics
Android programming basics
 
L0020 - The Basic RCP Application
L0020 - The Basic RCP ApplicationL0020 - The Basic RCP Application
L0020 - The Basic RCP Application
 
View groups containers
View groups containersView groups containers
View groups containers
 
Titanium appcelerator sdk
Titanium appcelerator sdkTitanium appcelerator sdk
Titanium appcelerator sdk
 

Similar to Ios - Introduction to platform & SDK

Introduction to Objective - C
Introduction to Objective - CIntroduction to Objective - C
Introduction to Objective - C
Asim Rais Siddiqui
 
Quick Start to iOS Development
Quick Start to iOS DevelopmentQuick Start to iOS Development
Quick Start to iOS Development
Jussi Pohjolainen
 
Code camp 2011 Getting Started with IOS, Una Daly
Code camp 2011 Getting Started with IOS, Una DalyCode camp 2011 Getting Started with IOS, Una Daly
Code camp 2011 Getting Started with IOS, Una Daly
Una Daly
 
Hello world ios v1
Hello world ios v1Hello world ios v1
Hello world ios v1
Teodoro Alonso
 
Android Bootcamp Tanzania:understanding ui in_android
Android Bootcamp Tanzania:understanding ui in_androidAndroid Bootcamp Tanzania:understanding ui in_android
Android Bootcamp Tanzania:understanding ui in_android
Denis Minja
 
Introduction To Google Android (Ft Rohan Bomle)
Introduction To Google Android (Ft Rohan Bomle)Introduction To Google Android (Ft Rohan Bomle)
Introduction To Google Android (Ft Rohan Bomle)
Fafadia Tech
 
iOS
iOSiOS
React Native for multi-platform mobile applications
React Native for multi-platform mobile applicationsReact Native for multi-platform mobile applications
React Native for multi-platform mobile applications
Matteo Manchi
 
02 objective-c session 2
02  objective-c session 202  objective-c session 2
02 objective-c session 2
Amr Elghadban (AmrAngry)
 
pebble - Building apps on pebble
pebble - Building apps on pebblepebble - Building apps on pebble
pebble - Building apps on pebble
Aniruddha Chakrabarti
 
Titanium appcelerator my first app
Titanium appcelerator my first appTitanium appcelerator my first app
Titanium appcelerator my first app
Alessio Ricco
 
Intro to Android Programming
Intro to Android ProgrammingIntro to Android Programming
Intro to Android Programming
Peter van der Linden
 
Lec005 android start_program
Lec005 android start_programLec005 android start_program
Lec005 android start_program
Eyad Almasri
 
iOS,From Development to Distribution
iOS,From Development to DistributioniOS,From Development to Distribution
iOS,From Development to Distribution
Tunvir Rahman Tusher
 
Use Eclipse technologies to build a modern embedded IDE
Use Eclipse technologies to build a modern embedded IDEUse Eclipse technologies to build a modern embedded IDE
Use Eclipse technologies to build a modern embedded IDE
Benjamin Cabé
 
Industrial Training in Android Application
Industrial Training in Android ApplicationIndustrial Training in Android Application
Industrial Training in Android Application
Arcadian Learning
 
CS6611 Mobile Application Development Lab Manual-2018-19
CS6611 Mobile Application Development Lab Manual-2018-19CS6611 Mobile Application Development Lab Manual-2018-19
CS6611 Mobile Application Development Lab Manual-2018-19
Gobinath Subramaniam
 
Keynote + Next Gen UIs.pptx
Keynote + Next Gen UIs.pptxKeynote + Next Gen UIs.pptx
Keynote + Next Gen UIs.pptx
EqraKhattak
 
Android installation guide
Android installation guideAndroid installation guide
Android installation guide
magicshui
 
Presentation1 password
Presentation1 passwordPresentation1 password
Presentation1 password
Ankit Desai
 

Similar to Ios - Introduction to platform & SDK (20)

Introduction to Objective - C
Introduction to Objective - CIntroduction to Objective - C
Introduction to Objective - C
 
Quick Start to iOS Development
Quick Start to iOS DevelopmentQuick Start to iOS Development
Quick Start to iOS Development
 
Code camp 2011 Getting Started with IOS, Una Daly
Code camp 2011 Getting Started with IOS, Una DalyCode camp 2011 Getting Started with IOS, Una Daly
Code camp 2011 Getting Started with IOS, Una Daly
 
Hello world ios v1
Hello world ios v1Hello world ios v1
Hello world ios v1
 
Android Bootcamp Tanzania:understanding ui in_android
Android Bootcamp Tanzania:understanding ui in_androidAndroid Bootcamp Tanzania:understanding ui in_android
Android Bootcamp Tanzania:understanding ui in_android
 
Introduction To Google Android (Ft Rohan Bomle)
Introduction To Google Android (Ft Rohan Bomle)Introduction To Google Android (Ft Rohan Bomle)
Introduction To Google Android (Ft Rohan Bomle)
 
iOS
iOSiOS
iOS
 
React Native for multi-platform mobile applications
React Native for multi-platform mobile applicationsReact Native for multi-platform mobile applications
React Native for multi-platform mobile applications
 
02 objective-c session 2
02  objective-c session 202  objective-c session 2
02 objective-c session 2
 
pebble - Building apps on pebble
pebble - Building apps on pebblepebble - Building apps on pebble
pebble - Building apps on pebble
 
Titanium appcelerator my first app
Titanium appcelerator my first appTitanium appcelerator my first app
Titanium appcelerator my first app
 
Intro to Android Programming
Intro to Android ProgrammingIntro to Android Programming
Intro to Android Programming
 
Lec005 android start_program
Lec005 android start_programLec005 android start_program
Lec005 android start_program
 
iOS,From Development to Distribution
iOS,From Development to DistributioniOS,From Development to Distribution
iOS,From Development to Distribution
 
Use Eclipse technologies to build a modern embedded IDE
Use Eclipse technologies to build a modern embedded IDEUse Eclipse technologies to build a modern embedded IDE
Use Eclipse technologies to build a modern embedded IDE
 
Industrial Training in Android Application
Industrial Training in Android ApplicationIndustrial Training in Android Application
Industrial Training in Android Application
 
CS6611 Mobile Application Development Lab Manual-2018-19
CS6611 Mobile Application Development Lab Manual-2018-19CS6611 Mobile Application Development Lab Manual-2018-19
CS6611 Mobile Application Development Lab Manual-2018-19
 
Keynote + Next Gen UIs.pptx
Keynote + Next Gen UIs.pptxKeynote + Next Gen UIs.pptx
Keynote + Next Gen UIs.pptx
 
Android installation guide
Android installation guideAndroid installation guide
Android installation guide
 
Presentation1 password
Presentation1 passwordPresentation1 password
Presentation1 password
 

More from Vibrant Technologies & Computers

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
Vibrant Technologies & Computers
 
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
Vibrant Technologies & Computers
 
SQL- Introduction to MySQL
SQL- Introduction to MySQLSQL- Introduction to MySQL
SQL- Introduction to MySQL
Vibrant Technologies & Computers
 
SQL- Introduction to SQL database
SQL- Introduction to SQL database SQL- Introduction to SQL database
SQL- Introduction to SQL database
Vibrant Technologies & Computers
 
ITIL - introduction to ITIL
ITIL - introduction to ITILITIL - introduction to ITIL
ITIL - introduction to ITIL
Vibrant Technologies & Computers
 
Salesforce - Introduction to Security & Access
Salesforce -  Introduction to Security & Access Salesforce -  Introduction to Security & Access
Salesforce - Introduction to Security & Access
Vibrant Technologies & Computers
 
Data ware housing- Introduction to olap .
Data ware housing- Introduction to  olap .Data ware housing- Introduction to  olap .
Data ware housing- Introduction to olap .
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
 
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
Vibrant Technologies & Computers
 
Salesforce - classification of cloud computing
Salesforce - classification of cloud computingSalesforce - classification of cloud computing
Salesforce - classification of cloud computing
Vibrant Technologies & Computers
 
Salesforce - cloud computing fundamental
Salesforce - cloud computing fundamentalSalesforce - cloud computing fundamental
Salesforce - cloud computing fundamental
Vibrant Technologies & Computers
 
SQL- Introduction to PL/SQL
SQL- Introduction to  PL/SQLSQL- Introduction to  PL/SQL
SQL- Introduction to PL/SQL
Vibrant Technologies & Computers
 
SQL- Introduction to advanced sql concepts
SQL- Introduction to  advanced sql conceptsSQL- Introduction to  advanced sql concepts
SQL- Introduction to advanced sql concepts
Vibrant Technologies & Computers
 
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
Vibrant Technologies & Computers
 
SQL- Introduction to SQL Set Operations
SQL- Introduction to SQL Set OperationsSQL- Introduction to SQL Set Operations
SQL- Introduction to SQL Set Operations
Vibrant Technologies & Computers
 
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
Vibrant Technologies & Computers
 
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
Vibrant Technologies & Computers
 
SAS - overview of SAS
SAS - overview of SASSAS - overview of SAS
SAS - overview of SAS
Vibrant Technologies & Computers
 
Teradata - Architecture of Teradata
Teradata - Architecture of TeradataTeradata - Architecture of Teradata
Teradata - Architecture of Teradata
Vibrant Technologies & Computers
 
Teradata - Restoring Data
Teradata - Restoring Data Teradata - Restoring Data
Teradata - Restoring Data
Vibrant Technologies & Computers
 

More from 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
 

Recently uploaded

How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
Daiki Mogmet Ito
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
DianaGray10
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
Claudio Di Ciccio
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Malak Abu Hammad
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
mikeeftimakis1
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
DianaGray10
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
shyamraj55
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Paige Cruz
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
innovationoecd
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
KAMESHS29
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
Alpen-Adria-Universität
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
Kari Kakkonen
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
名前 です男
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
Adtran
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
Neo4j
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
KatiaHIMEUR1
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
Kumud Singh
 
Data structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdfData structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdf
TIPNGVN2
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
Uni Systems S.M.S.A.
 
Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...
Zilliz
 

Recently uploaded (20)

How to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For FlutterHow to use Firebase Data Connect For Flutter
How to use Firebase Data Connect For Flutter
 
UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5UiPath Test Automation using UiPath Test Suite series, part 5
UiPath Test Automation using UiPath Test Suite series, part 5
 
“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”“I’m still / I’m still / Chaining from the Block”
“I’m still / I’m still / Chaining from the Block”
 
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdfUnlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
Unlock the Future of Search with MongoDB Atlas_ Vector Search Unleashed.pdf
 
Introduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - CybersecurityIntroduction to CHERI technology - Cybersecurity
Introduction to CHERI technology - Cybersecurity
 
Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1Communications Mining Series - Zero to Hero - Session 1
Communications Mining Series - Zero to Hero - Session 1
 
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with SlackLet's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
Let's Integrate MuleSoft RPA, COMPOSER, APM with AWS IDP along with Slack
 
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdfObservability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
Observability Concepts EVERY Developer Should Know -- DeveloperWeek Europe.pdf
 
Presentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of GermanyPresentation of the OECD Artificial Intelligence Review of Germany
Presentation of the OECD Artificial Intelligence Review of Germany
 
RESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for studentsRESUME BUILDER APPLICATION Project for students
RESUME BUILDER APPLICATION Project for students
 
Video Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the FutureVideo Streaming: Then, Now, and in the Future
Video Streaming: Then, Now, and in the Future
 
Climate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing DaysClimate Impact of Software Testing at Nordic Testing Days
Climate Impact of Software Testing at Nordic Testing Days
 
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
みなさんこんにちはこれ何文字まで入るの?40文字以下不可とか本当に意味わからないけどこれ限界文字数書いてないからマジでやばい文字数いけるんじゃないの?えこ...
 
Pushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 daysPushing the limits of ePRTC: 100ns holdover for 100 days
Pushing the limits of ePRTC: 100ns holdover for 100 days
 
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
GraphSummit Singapore | The Future of Agility: Supercharging Digital Transfor...
 
Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !Securing your Kubernetes cluster_ a step-by-step guide to success !
Securing your Kubernetes cluster_ a step-by-step guide to success !
 
Mind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AIMind map of terminologies used in context of Generative AI
Mind map of terminologies used in context of Generative AI
 
Data structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdfData structures and Algorithms in Python.pdf
Data structures and Algorithms in Python.pdf
 
Microsoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdfMicrosoft - Power Platform_G.Aspiotis.pdf
Microsoft - Power Platform_G.Aspiotis.pdf
 
Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...Building RAG with self-deployed Milvus vector database and Snowpark Container...
Building RAG with self-deployed Milvus vector database and Snowpark Container...
 

Ios - Introduction to platform & SDK

  • 4. 4/82 Market share Market Share 2012 Second mobile OS in usage First mobile OS in revenue First mobile OS in internet traffic
  • 5. 5/82 + Highest revenue for mobile OS + Little fragmentation (just iPhone and iPad) + Runs on high-end devices + Big developer community and excellent support + Many open-source libraries available - Strictly controlled by Apple - Development only possible in Mac OS - Objective C is the main programming language iOS: Advantages and disadvantages
  • 6. 6/82 Technology Application development in Objective C – a language that adds Smalltalk-style messaging to C Development done in Xcode on Mac OS devices Debugging and running on phone done also in Xcode
  • 7. 7/82 Installing development kit Install Xcode IDE – newest version 4.6.1 Installing Xcode automatically installs iOS SDK Xcode is free to download from Mac App store
  • 8. 8/82 Apple developer program Apple developer account is free Apple developer program is not free – 99$/year Registration done from https://developer.apple.com/programs/ios/ Registration process takes 3-5 days
  • 9. 9/82 iOS development 1010 1010 Develop No cost Debug Potential cost 1010 1010 Deploy Requires Developer Program Test Requires Developer Program
  • 10. 10/82 iOS debugging 1010 1010 Develop 1010 1010 Simulator does not require a developer program Debug 1010 1010 Device requires a Developer Provisioning Profile – 99$/year
  • 11. 11/82 App Store / Marketplace summary iOS Android Windows Phone Approval Process Yes No Yes Distribution outside the store No Yes No Fragmentation Very Little Yes Yes Multiple stores / Marketplaces No Yes No
  • 12. 12/82 Objective-C is an object oriented language Follows ANSI C style coding with methods from Smalltalk Flexible because almost everything is done at runtime: •Dynamic Binding •Dynamic Typing •Dynamic Linking It is used for both iOS and Mac OS development Source files: .m, header files: .h Has protocols, which work like interfaces in Java they specify a number of methods a class must implement Objective C
  • 13. 13/82 Almost every object manipulation is done by sending objects a message Two words within a set of brackets, the object identifier and the message to send: [self.mainLabel setText:[self.mainTextInput text]]; Dot syntax: self.mainLabel.text = self.mainTextInput.text; Equivalent to C++ or Java’s: this.mainLabel.setText( this.mainTextInput.text() ); Static methods start with +, instance methods with -: +(id)defaultController vs. -(void)initLocationManager Messages
  • 14. 14/82 A collection of libraries developed by Apple to aid GUI development Has a set of predefined classes and types such as NSNumber, NSString, NSDate (NS stands for NeXT-sun) Includes a root class NSObject where keywords like alloc, retain, and release come from Apple Human Interface Guidelines: http://developer.apple.com/library/ios/#documentation/UserExperience/Conceptual/Mobile Cocoa API
  • 15. 15/82 Objects are created dynamically using alloc keyword Objects are automatically deallocated in latest Objective-C through automatic reference counting (ARC) ARC keeps an internal count of how many times an Object is 'needed' System makes sure that objects that are needed are not deleted, and when an object is not needed it is deleted Memory allocation
  • 16. 16/82 C++ vs. Objective-C C++ Objective C Adds OOP, metaprogramming and generic programming to C Only adds OOP to C Comes with a std library Has no standard library; is dependant on other libraries Has numerous uses Mostly used for application building Large and complex code for OOP Simpler way of handling classes and objects
  • 18. 18/82 Hello World Task: “Change a label’s text using a button and an input box.” Create a new empty project:
  • 19. 19/82 New Project Name the project and check “Use Core Data” and “User Automatic Reference Counting”
  • 20. 20/82 New Project Create the project and also create local git repository for source control
  • 21. 21/82 Create interface Create a new storyboard file Empty storyboard will be created
  • 22. 22/82 Creating main screen Click on the storyboard Create a navigation controller from the storyboard designer by drag and drop
  • 23. 23/82 Delete default screen Delete the default Table View Controller and add your own View Controller by drag and drop Right click from the navigation controller to View Controller and choose root view controller relationship
  • 24. 24/82 Add items to screen Add items to screen by using drag and drop: label, button and text edit Attention! Disable “Use Autolayout” from View Controller properties if you want application to work in iOS 5 and earlier
  • 25. 25/82 Create a class for the screen The class should subclass UiViewController
  • 26. 26/82 Connect your class to the storyboard Make the View Controller in the storyboard to be you class Open Assistant editor Drag and drop interface objects to you class h file to create connections
  • 27. 27/82 Add an action to the button Right click on the button Choose “Touch Up Inside” and drag and drop to the h file Name the method that will be executed when button is touched
  • 28. 28/82 Add an action to the button Name the method that will be executed when button is touched
  • 29. 29/82 Header file will look like this: #import <UIKit/UIKit.h> @interface MainViewController : UIViewController @property (strong, nonatomic) IBOutlet UIButton *mainButton; @property (strong, nonatomic) IBOutlet UITextField *mainTextInput; @property (strong, nonatomic) IBOutlet UILabel *mainLabel; - (IBAction)changeLabel:(id)sender; @end Change label text: - (IBAction)changeLabel:(id)sender { // Change the text [self.mainLabel setText:[self.mainTextInput text]]; } Source files
  • 30. 30/82 Prepare application - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions { self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; // Override point for customization after application launch. self.window.backgroundColor = [UIColor whiteColor]; [self.window makeKeyAndVisible]; return YES; } Delete the gray bold text from didFinishLaunchingWithOptions Go to the auto-generated AppDelegate file and include your own Ui class
  • 31. 31/82 Run the applicationGo to project properties and set your storyboard as Main Storyboard Press run in simulator
  • 32. 32/82 Run the application on phone Open the organizer Log in with your developer id You need to be enroller in developer program Connect the phone to the computer Add the device to your provisioning portal
  • 34. 34/82 Include CoreLocation and MapKit Go to your project properties, libraries and press to add CoreLocation and MapKit for location and map support By default, they are not added to your project
  • 35. 35/82 Adding a Map View Add a Map View to you main screen from the designer
  • 36. 36/82 Displaying location on the map Check “Shows User Location” from Map View properties Run the application
  • 37. 37/82 .h file: #import <UIKit/UIKit.h> #import <MapKit/MapKit.h> @interface UEFPin : NSObject <MKAnnotation> @property (nonatomic, assign) CLLocationCoordinate2D coordinate; @property (nonatomic, strong) NSString *title; @property (nonatomic, strong) NSString *subtitle; -(id)initWithCoordinate:(CLLocationCoordinate2D)location andTitle:(NSString*)aTitle; @end .m File: #import "UEFPin.h" @implementation UEFPin @synthesize title, subtitle, coordinate; -(id)initWithCoordinate:(CLLocationCoordinate2D)location andTitle:(NSString*)aTitle { self = [super init]; if(self) { self.coordinate = location; self.title = aTitle; } return self; } @end Show a pin on the map Create a class which implements MKAnnotation protocol
  • 38. 38/82 - (void)viewDidAppear:(BOOL)animated { [super viewDidAppear:animated]; CLLocationCoordinate2D location; location.latitude = 62.598; location.longitude = 29.745; MKCoordinateRegion region; MKCoordinateSpan span; span.latitudeDelta=0.01; span.longitudeDelta=0.01; region.span=span; region.center=location; [mapView setDelegate:self]; [mapView addAnnotation:[[UEFPin alloc] initWithCoordinate:location andTitle:@"Joensuu Science Park"]]; [mapView setRegion:region animated:TRUE]; [mapView regionThatFits:region]; } Show a pin on the map In your view controller viewDidAppear create the pin and zoom to it Create a location Create a region centered on location Create the pin Zoom to the region Set self as map delegate
  • 39. 39/82 - (MKAnnotationView *) mapView:(MKMapView *)mapView viewForAnnotation:(id <MKAnnotation>) annotation{ MKPinAnnotationView *annView=[[MKPinAnnotationView alloc] initWithAnnotation:annotation reuseIdentifier:@"MapPin"]; annView.pinColor = MKPinAnnotationColorGreen; annView.animatesDrop=YES; annView.showsCallout=YES; return annView; } Show a pin on the map Make your view controller implement MKAnnotation protocol and implement viewForAnnotation method
  • 40. 40/82 @interface LocationController : NSObject <CLLocationManagerDelegate> // Class members: Location manager and current location container @property (nonatomic, retain) CLLocationManager *locationManager; @property (nonatomic, retain) CLLocation *currentLocation; + (id)defaultController; // Static singleton // Init, start and stop Location Manager - (void) initLocationManager; - (void) startLocationManager:(CLLocationAccuracy)accuracy; - (void) stopLocationManager; @end Handling locationCreate a class which implements CLLocationManagerDelegate protocol and has a CLLocationManager object Header file:
  • 41. 41/82 #import "LocationController.h" @implementation LocationController @synthesize locationManager, currentLocation; // Autogenerate getters and setters + (id)defaultController {// Static singleton static LocationController *sharedController = nil; static dispatch_once_t onceToken; dispatch_once(&onceToken, ^{ sharedController = [[self alloc] init]; }); return sharedController; } - (id) init {// This will be called when instantiating object self = [super init]; if (self != nil) { [self initLocationManager]; // Custom init code } return self; } -(void) dealloc { // Called when deleting objects if(self.locationManager != nil) [self.locationManager stopUpdatingLocation]; // Make sure all objects are nil so Automatic Reference Count will delete them [self setLocationManager:nil]; [self setCurrentLocation:nil]; } Handling location
  • 42. 42/82 - (void) initLocationManager { self.locationManager = [[CLLocationManager alloc] init]; self.locationManager.delegate = self; // send loc updates to myself currentLocation = [[CLLocation alloc] initWithLatitude:0 longitude:0]; // start location [self startLocationManager:kCLLocationAccuracyBestForNavigation]; } -(void) startLocationManager:(CLLocationAccuracy)accuracy { if(self.locationManager != nil) { self.locationManager.desiredAccuracy = accuracy; self.locationManager.distanceFilter = 0; self.locationManager.headingFilter = 0; // Start location updates if([CLLocationManager locationServicesEnabled]){ [self.locationManager startUpdatingLocation]; } } } -(void) stopLocationManager { [self.locationManager stopUpdatingLocation]; } Handling location
  • 43. 43/82 // This is called when location is updated - (void)locationManager:(CLLocationManager *)manager didUpdateToLocation: (CLLocation *)newLocation fromLocation:(CLLocation *)oldLocation { NSDate* eventDate = newLocation.timestamp; NSTimeInterval howRecent = [eventDate timeIntervalSinceNow]; if (abs(howRecent) < 60.0) { //Location timestamp is within the last 60.0 seconds, let's use it! if(newLocation.horizontalAccuracy < kMaxGpsAccuracy){ currentLocation = newLocation;; } } } Handling location
  • 44. 44/82 // Error handling - (void)locationManager:(CLLocationManager *)manager didFailWithError:(NSError *)error { NSString *errorString; switch([error code]) { case kCLErrorDenied: //Access denied by user errorString = @"Access to Location Services denied by user“; break; case kCLErrorLocationUnknown: //Probably temporary... errorString = @"Location data unavailable“; break; default: errorString = @"An unknown error has occurred"; break; } NSLog(@"Error: %@“, errorString); } @end // End of class implementation Handling location
  • 45. 45/82 ThankThank You !!!You !!! For More Information click below link: Follow Us on: http://vibranttechnologies.co.in/ios-classes-in-mumbai.html