SlideShare ist ein Scribd-Unternehmen logo
1 von 22
iOS Application Development
        -Hussain KMR Behestee
           The Jaxara IT LTD.
              [Session-3]
Agendas


∗ Programming with Segue
∗ Dynamic design through coding
  ∗ Views and its Co-ordinates
∗ Core animations
∗ Picture pickers
∗ Sound manager
∗ Address book picker
Programming with Segue
Segue in Storyboarding
Programming with Segue
What is Segue?
Programming with Segue
Life Cycle of Segue
∗ Your app never creates segue objects directly, they are always created on
  your behalf by iOS when a segue is triggered.
∗ The destination controller is created and initialized.
∗ The segue object is created and its initWithIdentifier:source:destination:
  method is called. The identifier is the unique string you provided for the
  segue in Interface Builder, and the two other parameters represent the
  two controller objects in the transition.
∗ The source view controller’s prepareForSegue:sender: method is called.
∗ The segue object’s perform method is called. This method performs a
  transition to bring the destination view controller on-screen.
∗ The reference to the segue object is released, causing it to be
  deallocated.
Programming with Segue

Triggering a segue programmatically
- (void)orientationChanged:(NSNotification *)notification
{
   UIDeviceOrientation deviceOrientation =
            [UIDevice currentDevice].orientation;

    if (UIDeviceOrientationIsLandscape(deviceOrientation) &&
       !isShowingLandscapeView)

    {
        [self performSegueWithIdentifier:@"DisplayAlternateView" sender:self];
        isShowingLandscapeView = YES;
    }
}
Dynamic design through coding


        UIView's frame:     The CGPoint:           The CGSize :
        struct CGRect       struct CGPoint         struct CGSize
        { CGPoint origin;   { CGFloat x; CGFloat   { CGFloat width;
        CGSize size; };     y; };                  CGFloat height; };


        [button setFrame:CGRectMake(x, y, width, height)];
Dynamic design through coding
Dynamic design through coding


∗ Creating UI Object on the fly
  UIImageView* campFireView = [[UIImageView alloc]
    initWithFrame: self.view.frame];
  campFireView.image = [UIImage
    imageWithName:@"image.png"];
∗ Adding to view
  [self.view addSubview: campFireView];
Core animations


∗ View Based Animation
  [UIView beginAnimations:nil context:NULL];
  [UIView setAnimationDuration:0.8];
  //animation logic here
  [UIView commitAnimations];
∗ Set animation complete callback
  [UIView setAnimationDidStopSelector:
    @selector(onAnimationComplete:finished:context:)];
∗ onAnimationComplete – Callback
  - (void)onAnimationComplete:(NSString *)animationID finished:
      (NSNumber *)finished context:(void *)context
Core animations

∗ Image Based Animation
   ∗   create the view that will execute our animation
   UIImageView* campFireView = [[UIImageView alloc]
      initWithFrame:self.view.frame];
   ∗   load all the frames of our animation
   campFireView.animationImages = [NSArray arrayWithObjects:
        [UIImage imageNamed:@"campFire01.gif"],
        [UIImage imageNamed:@"campFire02.gif"], nil];
   campFireView.animationDuration = 1.75;
   ∗   repeat the annimation forever
   campFireView.animationRepeatCount = 0;
   ∗   start animating
   [campFireView startAnimating];
   ∗ add the animation view to the main window
   [self.view addSubview:campFireView];
Picture pickers
Initialization..

∗ Initialize the Image Picker and set delegate for interaction
  picker = [[UIImagePickerController alloc] init];
  picker.delegate = self;
∗ Checking and setting Source type
  if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]){
           picker.sourceType = UIImagePickerControllerSourceTypeCamera;
  } else{
           picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
  }

∗ Call the picker to front
  [self presentViewController:picker animated:YES completion:NULL];
Picture pickers
Grabbing the image

∗ If the user cancels we just dismiss the picker and release the object
    - (void)imagePickerControllerDidCancel:(UIImagePickerController *) Picker
    {
             [[picker presentingViewController] dismissViewControllerAnimated:YES
                         completion:NULL];
    }
∗ But if the user selects an image or takes a photo with the camera
    (void)imagePickerController:(UIImagePickerController *)picker
    didFinishPickingMediaWithInfo:(NSDictionary *)info{
    {
            selectedImage.image = [info
                       objectForKey:UIImagePickerControllerOriginalImage];

            [[picker presentingViewController] dismissViewControllerAnimated:YES
                        completion:NULL];
    }
∗   For more information
Sound manager


∗ Get the main bundle for the app
  CFBundleRef mainBundle = CFBundleGetMainBundle ();
∗ Get the URL to the sound file to play
  CFURLRef soundFileURLRef;
  soundFileURLRef = CFBundleCopyResourceURL ( mainBundle,
    CFSTR ("tap"), CFSTR ("aif"), NULL);
∗ Create a system sound object representing the sound file
  SystemSoundID soundFileObject;
  AudioServicesCreateSystemSoundID (soundFileURLRef,
    &soundFileObject);
Sound manager


∗ For System Sound Play
  AudioServicesPlaySystemSound (soundFileObject);
∗ For Alert Sound Play
  AudioServicesPlayAlertSound (soundFileObject);
∗ For Vibrate Play
  AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
Address book picker


∗   Add Framework: AddressBookUI, AddressBook
∗   Add Header File: #import <AddressBookUI/AddressBookUI.h>
∗   Add Protocol : ABPeoplePickerNavigationControllerDelegate
∗   Responding to User Events
    ∗ peoplePickerNavigationController:shouldContinueAfterSelectingPerson:
    ∗ peoplePickerNavigationController:shouldContinueAfterSelectingPerson:pro
      perty:identifier:
    ∗ peoplePickerNavigationControllerDidCancel:
Address book picker
Address book picker
Address book picker
Address book picker
Question?




Thanks

Weitere ähnliche Inhalte

Was ist angesagt?

Model View Intent on Android
Model View Intent on AndroidModel View Intent on Android
Model View Intent on AndroidCody Engel
 
Building Robust jQuery Plugins
Building Robust jQuery PluginsBuilding Robust jQuery Plugins
Building Robust jQuery PluginsJörn Zaefferer
 
The Ring programming language version 1.5.1 book - Part 45 of 180
The Ring programming language version 1.5.1 book - Part 45 of 180The Ring programming language version 1.5.1 book - Part 45 of 180
The Ring programming language version 1.5.1 book - Part 45 of 180Mahmoud Samir Fayed
 
Tools for developing Android Games
 Tools for developing Android Games Tools for developing Android Games
Tools for developing Android GamesPlatty Soft
 
A split screen-viable UI event system - Unite Copenhagen 2019
A split screen-viable UI event system - Unite Copenhagen 2019A split screen-viable UI event system - Unite Copenhagen 2019
A split screen-viable UI event system - Unite Copenhagen 2019Unity Technologies
 
Game Project / Working with Unity
Game Project / Working with UnityGame Project / Working with Unity
Game Project / Working with UnityPetri Lankoski
 
Useful Tools for Making Video Games - Irrlicht (2008)
Useful Tools for Making Video Games - Irrlicht (2008)Useful Tools for Making Video Games - Irrlicht (2008)
Useful Tools for Making Video Games - Irrlicht (2008)Korhan Bircan
 
libGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame AnimationlibGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame AnimationJussi Pohjolainen
 
Unity遊戲程式設計(15) 實作Space shooter遊戲
Unity遊戲程式設計(15) 實作Space shooter遊戲Unity遊戲程式設計(15) 實作Space shooter遊戲
Unity遊戲程式設計(15) 實作Space shooter遊戲吳錫修 (ShyiShiou Wu)
 
Core Image: The Most Fun API You're Not Using (CocoaConf Columbus 2014)
Core Image: The Most Fun API You're Not Using (CocoaConf Columbus 2014)Core Image: The Most Fun API You're Not Using (CocoaConf Columbus 2014)
Core Image: The Most Fun API You're Not Using (CocoaConf Columbus 2014)Chris Adamson
 
Cross-scene references: A shock to the system - Unite Copenhagen 2019
Cross-scene references: A shock to the system - Unite Copenhagen 2019Cross-scene references: A shock to the system - Unite Copenhagen 2019
Cross-scene references: A shock to the system - Unite Copenhagen 2019Unity Technologies
 
Daniel Jalkut - dotSwift 2019
Daniel Jalkut - dotSwift 2019Daniel Jalkut - dotSwift 2019
Daniel Jalkut - dotSwift 2019DanielJalkut
 
Asynchronous Programming with JavaScript
Asynchronous Programming with JavaScriptAsynchronous Programming with JavaScript
Asynchronous Programming with JavaScriptWebF
 
QML\Qt Quick на практике
QML\Qt Quick на практикеQML\Qt Quick на практике
QML\Qt Quick на практикеPlatonov Sergey
 
Node meetup feb_20_12
Node meetup feb_20_12Node meetup feb_20_12
Node meetup feb_20_12jafar104
 
I phone勉強会 (2011.11.23)
I phone勉強会 (2011.11.23)I phone勉強会 (2011.11.23)
I phone勉強会 (2011.11.23)Katsumi Kishikawa
 

Was ist angesagt? (20)

Model View Intent on Android
Model View Intent on AndroidModel View Intent on Android
Model View Intent on Android
 
Box2D and libGDX
Box2D and libGDXBox2D and libGDX
Box2D and libGDX
 
Building Robust jQuery Plugins
Building Robust jQuery PluginsBuilding Robust jQuery Plugins
Building Robust jQuery Plugins
 
The Ring programming language version 1.5.1 book - Part 45 of 180
The Ring programming language version 1.5.1 book - Part 45 of 180The Ring programming language version 1.5.1 book - Part 45 of 180
The Ring programming language version 1.5.1 book - Part 45 of 180
 
Tools for developing Android Games
 Tools for developing Android Games Tools for developing Android Games
Tools for developing Android Games
 
004
004004
004
 
A split screen-viable UI event system - Unite Copenhagen 2019
A split screen-viable UI event system - Unite Copenhagen 2019A split screen-viable UI event system - Unite Copenhagen 2019
A split screen-viable UI event system - Unite Copenhagen 2019
 
Game Project / Working with Unity
Game Project / Working with UnityGame Project / Working with Unity
Game Project / Working with Unity
 
Useful Tools for Making Video Games - Irrlicht (2008)
Useful Tools for Making Video Games - Irrlicht (2008)Useful Tools for Making Video Games - Irrlicht (2008)
Useful Tools for Making Video Games - Irrlicht (2008)
 
libGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame AnimationlibGDX: User Input and Frame by Frame Animation
libGDX: User Input and Frame by Frame Animation
 
Unity遊戲程式設計(15) 實作Space shooter遊戲
Unity遊戲程式設計(15) 實作Space shooter遊戲Unity遊戲程式設計(15) 實作Space shooter遊戲
Unity遊戲程式設計(15) 實作Space shooter遊戲
 
libGDX: Tiled Maps
libGDX: Tiled MapslibGDX: Tiled Maps
libGDX: Tiled Maps
 
Core Image: The Most Fun API You're Not Using (CocoaConf Columbus 2014)
Core Image: The Most Fun API You're Not Using (CocoaConf Columbus 2014)Core Image: The Most Fun API You're Not Using (CocoaConf Columbus 2014)
Core Image: The Most Fun API You're Not Using (CocoaConf Columbus 2014)
 
Cross-scene references: A shock to the system - Unite Copenhagen 2019
Cross-scene references: A shock to the system - Unite Copenhagen 2019Cross-scene references: A shock to the system - Unite Copenhagen 2019
Cross-scene references: A shock to the system - Unite Copenhagen 2019
 
Daniel Jalkut - dotSwift 2019
Daniel Jalkut - dotSwift 2019Daniel Jalkut - dotSwift 2019
Daniel Jalkut - dotSwift 2019
 
Unity workshop
Unity workshopUnity workshop
Unity workshop
 
Asynchronous Programming with JavaScript
Asynchronous Programming with JavaScriptAsynchronous Programming with JavaScript
Asynchronous Programming with JavaScript
 
QML\Qt Quick на практике
QML\Qt Quick на практикеQML\Qt Quick на практике
QML\Qt Quick на практике
 
Node meetup feb_20_12
Node meetup feb_20_12Node meetup feb_20_12
Node meetup feb_20_12
 
I phone勉強会 (2011.11.23)
I phone勉強会 (2011.11.23)I phone勉強会 (2011.11.23)
I phone勉強会 (2011.11.23)
 

Andere mochten auch

Best Apple IOS Training in Chennai | Best Iphone Training in Chennai
Best Apple IOS Training in Chennai | Best Iphone Training in ChennaiBest Apple IOS Training in Chennai | Best Iphone Training in Chennai
Best Apple IOS Training in Chennai | Best Iphone Training in ChennaiCore Mind
 
iOS 8 App Extensions
iOS 8 App ExtensionsiOS 8 App Extensions
iOS 8 App Extensionsravi kumar
 
iOS and Android Training Workshops 2016 by Teks Mobile Sverige
iOS and Android Training Workshops 2016 by Teks Mobile SverigeiOS and Android Training Workshops 2016 by Teks Mobile Sverige
iOS and Android Training Workshops 2016 by Teks Mobile SverigeSayudh Sarkar
 
Android session 3-behestee
Android session 3-behesteeAndroid session 3-behestee
Android session 3-behesteeHussain Behestee
 
iOS app dev Training - Session1
iOS app dev Training - Session1iOS app dev Training - Session1
iOS app dev Training - Session1Hussain Behestee
 
ASP.NET MVC introduction
ASP.NET MVC introductionASP.NET MVC introduction
ASP.NET MVC introductionTomi Juhola
 
Android session 2-behestee
Android session 2-behesteeAndroid session 2-behestee
Android session 2-behesteeHussain Behestee
 
Echelon MillionAir magazine
Echelon MillionAir magazineEchelon MillionAir magazine
Echelon MillionAir magazineEchelonExp
 
CodeCamp general info
CodeCamp general infoCodeCamp general info
CodeCamp general infoTomi Juhola
 
Android session 4-behestee
Android session 4-behesteeAndroid session 4-behestee
Android session 4-behesteeHussain Behestee
 
iOS Developer Online Training
iOS Developer Online TrainingiOS Developer Online Training
iOS Developer Online TrainingCSS INDIA
 
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
 
First Steps in iOS Development
First Steps in iOS DevelopmentFirst Steps in iOS Development
First Steps in iOS DevelopmentSasha Goldshtein
 
iPhone application development training day 1
iPhone application development training day 1iPhone application development training day 1
iPhone application development training day 1Shyamala Prayaga
 
Build Your First iOS App With Swift
Build Your First iOS App With SwiftBuild Your First iOS App With Swift
Build Your First iOS App With SwiftEdureka!
 

Andere mochten auch (20)

Best Apple IOS Training in Chennai | Best Iphone Training in Chennai
Best Apple IOS Training in Chennai | Best Iphone Training in ChennaiBest Apple IOS Training in Chennai | Best Iphone Training in Chennai
Best Apple IOS Training in Chennai | Best Iphone Training in Chennai
 
iOS 8 App Extensions
iOS 8 App ExtensionsiOS 8 App Extensions
iOS 8 App Extensions
 
iOS and Android Training Workshops 2016 by Teks Mobile Sverige
iOS and Android Training Workshops 2016 by Teks Mobile SverigeiOS and Android Training Workshops 2016 by Teks Mobile Sverige
iOS and Android Training Workshops 2016 by Teks Mobile Sverige
 
Android session 3-behestee
Android session 3-behesteeAndroid session 3-behestee
Android session 3-behestee
 
iOS app dev Training - Session1
iOS app dev Training - Session1iOS app dev Training - Session1
iOS app dev Training - Session1
 
Android session-1-sajib
Android session-1-sajibAndroid session-1-sajib
Android session-1-sajib
 
Android session-5-sajib
Android session-5-sajibAndroid session-5-sajib
Android session-5-sajib
 
ASP.NET MVC introduction
ASP.NET MVC introductionASP.NET MVC introduction
ASP.NET MVC introduction
 
Android session 2-behestee
Android session 2-behesteeAndroid session 2-behestee
Android session 2-behestee
 
Echelon MillionAir magazine
Echelon MillionAir magazineEchelon MillionAir magazine
Echelon MillionAir magazine
 
CodeCamp general info
CodeCamp general infoCodeCamp general info
CodeCamp general info
 
iOS Session-2
iOS Session-2iOS Session-2
iOS Session-2
 
Android session 4-behestee
Android session 4-behesteeAndroid session 4-behestee
Android session 4-behestee
 
iOS Developer Online Training
iOS Developer Online TrainingiOS Developer Online Training
iOS Developer Online Training
 
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
 
First Steps in iOS Development
First Steps in iOS DevelopmentFirst Steps in iOS Development
First Steps in iOS Development
 
iOS training (basic)
iOS training (basic)iOS training (basic)
iOS training (basic)
 
iPhone application development training day 1
iPhone application development training day 1iPhone application development training day 1
iPhone application development training day 1
 
Build Your First iOS App With Swift
Build Your First iOS App With SwiftBuild Your First iOS App With Swift
Build Your First iOS App With Swift
 
iOS training (intermediate)
iOS training (intermediate)iOS training (intermediate)
iOS training (intermediate)
 

Ähnlich wie iOS Training Session-3

Leaving Interface Builder Behind
Leaving Interface Builder BehindLeaving Interface Builder Behind
Leaving Interface Builder BehindJohn Wilker
 
Synchronizing without internet - Multipeer Connectivity (iOS)
Synchronizing without internet - Multipeer Connectivity (iOS)Synchronizing without internet - Multipeer Connectivity (iOS)
Synchronizing without internet - Multipeer Connectivity (iOS)Jorge Maroto
 
Ui perfomance
Ui perfomanceUi perfomance
Ui perfomanceCleveroad
 
Core Image: The Most Fun API You're Not Using, CocoaConf Atlanta, December 2014
Core Image: The Most Fun API You're Not Using, CocoaConf Atlanta, December 2014Core Image: The Most Fun API You're Not Using, CocoaConf Atlanta, December 2014
Core Image: The Most Fun API You're Not Using, CocoaConf Atlanta, December 2014Chris Adamson
 
Yahoo Open Source - The Tour & Mystery of AppDevKit (MOPCON 2016)
Yahoo Open Source - The Tour & Mystery of AppDevKit (MOPCON 2016)Yahoo Open Source - The Tour & Mystery of AppDevKit (MOPCON 2016)
Yahoo Open Source - The Tour & Mystery of AppDevKit (MOPCON 2016)anistar sung
 
iPhoneOS3.1でのカメラAPIについて
iPhoneOS3.1でのカメラAPIについてiPhoneOS3.1でのカメラAPIについて
iPhoneOS3.1でのカメラAPIについてKyosuke Takayama
 
MOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app developmentMOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app developmentanistar sung
 
Session 15 - Working with Image, Scroll, Collection, Picker, and Web View
Session 15  - Working with Image, Scroll, Collection, Picker, and Web ViewSession 15  - Working with Image, Scroll, Collection, Picker, and Web View
Session 15 - Working with Image, Scroll, Collection, Picker, and Web ViewVu Tran Lam
 
CocoaHeads Toulouse - Guillaume Cerquant - UIView
CocoaHeads Toulouse - Guillaume Cerquant - UIViewCocoaHeads Toulouse - Guillaume Cerquant - UIView
CocoaHeads Toulouse - Guillaume Cerquant - UIViewCocoaHeads France
 
Building a Native Camera Access Library - Part V.pdf
Building a Native Camera Access Library - Part V.pdfBuilding a Native Camera Access Library - Part V.pdf
Building a Native Camera Access Library - Part V.pdfShaiAlmog1
 
303 TANSTAAFL: Using Open Source iPhone UI Code
303 TANSTAAFL: Using Open Source iPhone UI Code303 TANSTAAFL: Using Open Source iPhone UI Code
303 TANSTAAFL: Using Open Source iPhone UI Codejonmarimba
 
Building a Native Camera Access Library - Part I.pdf
Building a Native Camera Access Library - Part I.pdfBuilding a Native Camera Access Library - Part I.pdf
Building a Native Camera Access Library - Part I.pdfShaiAlmog1
 
Integrating Angular js & three.js
Integrating Angular js & three.jsIntegrating Angular js & three.js
Integrating Angular js & three.jsJosh Staples
 
Iphone os dev sharing with new examples
Iphone os dev sharing with new examplesIphone os dev sharing with new examples
Iphone os dev sharing with new exampleskenshin03
 
Desenvolvimento iOS - Aula 4
Desenvolvimento iOS - Aula 4Desenvolvimento iOS - Aula 4
Desenvolvimento iOS - Aula 4Saulo Arruda
 

Ähnlich wie iOS Training Session-3 (20)

Leaving Interface Builder Behind
Leaving Interface Builder BehindLeaving Interface Builder Behind
Leaving Interface Builder Behind
 
Synchronizing without internet - Multipeer Connectivity (iOS)
Synchronizing without internet - Multipeer Connectivity (iOS)Synchronizing without internet - Multipeer Connectivity (iOS)
Synchronizing without internet - Multipeer Connectivity (iOS)
 
Ui perfomance
Ui perfomanceUi perfomance
Ui perfomance
 
Core Image: The Most Fun API You're Not Using, CocoaConf Atlanta, December 2014
Core Image: The Most Fun API You're Not Using, CocoaConf Atlanta, December 2014Core Image: The Most Fun API You're Not Using, CocoaConf Atlanta, December 2014
Core Image: The Most Fun API You're Not Using, CocoaConf Atlanta, December 2014
 
Yahoo Open Source - The Tour & Mystery of AppDevKit (MOPCON 2016)
Yahoo Open Source - The Tour & Mystery of AppDevKit (MOPCON 2016)Yahoo Open Source - The Tour & Mystery of AppDevKit (MOPCON 2016)
Yahoo Open Source - The Tour & Mystery of AppDevKit (MOPCON 2016)
 
iPhoneOS3.1でのカメラAPIについて
iPhoneOS3.1でのカメラAPIについてiPhoneOS3.1でのカメラAPIについて
iPhoneOS3.1でのカメラAPIについて
 
iphonedevcon 2010: Cooking with iAd
iphonedevcon 2010:  Cooking with iAd iphonedevcon 2010:  Cooking with iAd
iphonedevcon 2010: Cooking with iAd
 
iOS
iOSiOS
iOS
 
MOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app developmentMOPCON 2014 - Best software architecture in app development
MOPCON 2014 - Best software architecture in app development
 
Session 15 - Working with Image, Scroll, Collection, Picker, and Web View
Session 15  - Working with Image, Scroll, Collection, Picker, and Web ViewSession 15  - Working with Image, Scroll, Collection, Picker, and Web View
Session 15 - Working with Image, Scroll, Collection, Picker, and Web View
 
CocoaHeads Toulouse - Guillaume Cerquant - UIView
CocoaHeads Toulouse - Guillaume Cerquant - UIViewCocoaHeads Toulouse - Guillaume Cerquant - UIView
CocoaHeads Toulouse - Guillaume Cerquant - UIView
 
Building a Native Camera Access Library - Part V.pdf
Building a Native Camera Access Library - Part V.pdfBuilding a Native Camera Access Library - Part V.pdf
Building a Native Camera Access Library - Part V.pdf
 
303 TANSTAAFL: Using Open Source iPhone UI Code
303 TANSTAAFL: Using Open Source iPhone UI Code303 TANSTAAFL: Using Open Source iPhone UI Code
303 TANSTAAFL: Using Open Source iPhone UI Code
 
Building a Native Camera Access Library - Part I.pdf
Building a Native Camera Access Library - Part I.pdfBuilding a Native Camera Access Library - Part I.pdf
Building a Native Camera Access Library - Part I.pdf
 
Integrating Angular js & three.js
Integrating Angular js & three.jsIntegrating Angular js & three.js
Integrating Angular js & three.js
 
Core animation
Core animationCore animation
Core animation
 
I os 11
I os 11I os 11
I os 11
 
Iphone os dev sharing with new examples
Iphone os dev sharing with new examplesIphone os dev sharing with new examples
Iphone os dev sharing with new examples
 
QXCameraKit
QXCameraKitQXCameraKit
QXCameraKit
 
Desenvolvimento iOS - Aula 4
Desenvolvimento iOS - Aula 4Desenvolvimento iOS - Aula 4
Desenvolvimento iOS - Aula 4
 

iOS Training Session-3

  • 1.
  • 2. iOS Application Development -Hussain KMR Behestee The Jaxara IT LTD. [Session-3]
  • 3. Agendas ∗ Programming with Segue ∗ Dynamic design through coding ∗ Views and its Co-ordinates ∗ Core animations ∗ Picture pickers ∗ Sound manager ∗ Address book picker
  • 4. Programming with Segue Segue in Storyboarding
  • 6. Programming with Segue Life Cycle of Segue ∗ Your app never creates segue objects directly, they are always created on your behalf by iOS when a segue is triggered. ∗ The destination controller is created and initialized. ∗ The segue object is created and its initWithIdentifier:source:destination: method is called. The identifier is the unique string you provided for the segue in Interface Builder, and the two other parameters represent the two controller objects in the transition. ∗ The source view controller’s prepareForSegue:sender: method is called. ∗ The segue object’s perform method is called. This method performs a transition to bring the destination view controller on-screen. ∗ The reference to the segue object is released, causing it to be deallocated.
  • 7. Programming with Segue Triggering a segue programmatically - (void)orientationChanged:(NSNotification *)notification { UIDeviceOrientation deviceOrientation = [UIDevice currentDevice].orientation; if (UIDeviceOrientationIsLandscape(deviceOrientation) && !isShowingLandscapeView) { [self performSegueWithIdentifier:@"DisplayAlternateView" sender:self]; isShowingLandscapeView = YES; } }
  • 8. Dynamic design through coding UIView's frame: The CGPoint: The CGSize : struct CGRect struct CGPoint struct CGSize { CGPoint origin; { CGFloat x; CGFloat { CGFloat width; CGSize size; }; y; }; CGFloat height; }; [button setFrame:CGRectMake(x, y, width, height)];
  • 10. Dynamic design through coding ∗ Creating UI Object on the fly UIImageView* campFireView = [[UIImageView alloc] initWithFrame: self.view.frame]; campFireView.image = [UIImage imageWithName:@"image.png"]; ∗ Adding to view [self.view addSubview: campFireView];
  • 11. Core animations ∗ View Based Animation [UIView beginAnimations:nil context:NULL]; [UIView setAnimationDuration:0.8]; //animation logic here [UIView commitAnimations]; ∗ Set animation complete callback [UIView setAnimationDidStopSelector: @selector(onAnimationComplete:finished:context:)]; ∗ onAnimationComplete – Callback - (void)onAnimationComplete:(NSString *)animationID finished: (NSNumber *)finished context:(void *)context
  • 12. Core animations ∗ Image Based Animation ∗ create the view that will execute our animation UIImageView* campFireView = [[UIImageView alloc] initWithFrame:self.view.frame]; ∗ load all the frames of our animation campFireView.animationImages = [NSArray arrayWithObjects: [UIImage imageNamed:@"campFire01.gif"], [UIImage imageNamed:@"campFire02.gif"], nil]; campFireView.animationDuration = 1.75; ∗ repeat the annimation forever campFireView.animationRepeatCount = 0; ∗ start animating [campFireView startAnimating]; ∗ add the animation view to the main window [self.view addSubview:campFireView];
  • 13. Picture pickers Initialization.. ∗ Initialize the Image Picker and set delegate for interaction picker = [[UIImagePickerController alloc] init]; picker.delegate = self; ∗ Checking and setting Source type if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]){ picker.sourceType = UIImagePickerControllerSourceTypeCamera; } else{ picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary; } ∗ Call the picker to front [self presentViewController:picker animated:YES completion:NULL];
  • 14. Picture pickers Grabbing the image ∗ If the user cancels we just dismiss the picker and release the object - (void)imagePickerControllerDidCancel:(UIImagePickerController *) Picker { [[picker presentingViewController] dismissViewControllerAnimated:YES completion:NULL]; } ∗ But if the user selects an image or takes a photo with the camera (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info{ { selectedImage.image = [info objectForKey:UIImagePickerControllerOriginalImage]; [[picker presentingViewController] dismissViewControllerAnimated:YES completion:NULL]; } ∗ For more information
  • 15. Sound manager ∗ Get the main bundle for the app CFBundleRef mainBundle = CFBundleGetMainBundle (); ∗ Get the URL to the sound file to play CFURLRef soundFileURLRef; soundFileURLRef = CFBundleCopyResourceURL ( mainBundle, CFSTR ("tap"), CFSTR ("aif"), NULL); ∗ Create a system sound object representing the sound file SystemSoundID soundFileObject; AudioServicesCreateSystemSoundID (soundFileURLRef, &soundFileObject);
  • 16. Sound manager ∗ For System Sound Play AudioServicesPlaySystemSound (soundFileObject); ∗ For Alert Sound Play AudioServicesPlayAlertSound (soundFileObject); ∗ For Vibrate Play AudioServicesPlaySystemSound(kSystemSoundID_Vibrate);
  • 17. Address book picker ∗ Add Framework: AddressBookUI, AddressBook ∗ Add Header File: #import <AddressBookUI/AddressBookUI.h> ∗ Add Protocol : ABPeoplePickerNavigationControllerDelegate ∗ Responding to User Events ∗ peoplePickerNavigationController:shouldContinueAfterSelectingPerson: ∗ peoplePickerNavigationController:shouldContinueAfterSelectingPerson:pro perty:identifier: ∗ peoplePickerNavigationControllerDidCancel: