Monday, 28 September 2015

Working With CoreGraphics and Implementation in Ios/iphone

=> First Use Take Enumration: Of Diffrent Drowing Item:


#import <UIKit/UIKit.h>

typedef enum {
    DrawingLine,
    DrawingPath = 1,
    DrawingFillPath = 2,
    DrawingRect = 3,
    DrawingFillRect = 4,
    DrawingCircle = 5,
    DrawingArc = 6,
    DrawingCubicCurve = 7,
    DrawingQuadraticCurve = 8,
    DrawingDashLine = 9,
    DrawingShadow = 10,
    DrawingImage = 11,
}DrawingType;

==> Here Inherited From UIView :

@interface CoreDrowingView : UIView

@property (nonatomic,assign)DrawingType type;

- (id)initWithFrame:(CGRect)frame anddrawingType:(DrawingType)aType;

@end

-----------------


=> Now to drow diffrent  thing Using Core Graphics like arc, parth ,circle, etc
#import "CoreDrowingView.h"

@implementation CoreDrowingView

- (id)initWithFrame:(CGRect)frame anddrawingType:(DrawingType)aType
{
    self = [super initWithFrame:frame];
    if (self) {
        self.type = aType;
        self.backgroundColor= [UIColor whiteColor];
        // Initialization code
    }
    return self;
}




// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect
{
    // Drawing code
   
    //Drawing a Line
   
    switch (self.type) {
        case DrawingLine:{
            CGContextRef context = UIGraphicsGetCurrentContext();
            CGContextSetLineWidth(context, 2.0);
            CGColorSpaceRef colorspace = CGColorSpaceCreateDeviceRGB();
            CGFloat components[] = {0.0, 0.0, 1.0, 1.0};
            CGColorRef color = CGColorCreate(colorspace, components);
            CGContextSetStrokeColorWithColor(context, color);
            CGContextMoveToPoint(context, 30, 30);
            CGContextAddLineToPoint(context, 300, 400);
            CGContextStrokePath(context);
            CGColorSpaceRelease(colorspace);
            CGColorRelease(color);
            break;
        }
           
          ==> Here Drowing  For Path Drawing:

        case DrawingPath:{
            CGContextRef context = UIGraphicsGetCurrentContext();
            CGContextSetLineWidth(context, 2.0);
            CGContextSetStrokeColorWithColor(context,
                                             [UIColor blueColor].CGColor);
            CGContextMoveToPoint(context, 100, 100);
            CGContextAddLineToPoint(context, 150, 150);
            CGContextAddLineToPoint(context, 100, 200);
            CGContextAddLineToPoint(context, 50, 150);
            CGContextAddLineToPoint(context, 100, 100);
            CGContextStrokePath(context);
            break;
        }
           
        ==> Here Drowing  For Rect Drawing:

        case DrawingRect:{
            CGContextRef context = UIGraphicsGetCurrentContext();
            CGContextSetLineWidth(context, 4.0);
            CGContextSetStrokeColorWithColor(context,
                                             [UIColor blueColor].CGColor);
            CGRect rectangle = CGRectMake(60,170,200,80);
            CGContextAddRect(context, rectangle);
            CGContextStrokePath(context);
            break;
        }
           
      ==> Here Drowing  ForFor Path With Fill Color:\

        case DrawingFillPath:{
            CGContextRef context = UIGraphicsGetCurrentContext();
            CGContextMoveToPoint(context, 100, 100);
            CGContextAddLineToPoint(context, 150, 150);
            CGContextAddLineToPoint(context, 100, 200);
            CGContextAddLineToPoint(context, 50, 150);
            CGContextAddLineToPoint(context, 100, 100);
            CGContextSetFillColorWithColor(context,
                                           [UIColor redColor].CGColor);
            CGContextFillPath(context);
            break;
        }
           
         ==> Here Drowing  For Rect With Fill Color:

        case DrawingFillRect:{
            CGContextRef context = UIGraphicsGetCurrentContext();
            CGContextSetLineWidth(context, 4.0);
            CGContextSetStrokeColorWithColor(context,
                                             [UIColor blueColor].CGColor);
            CGRect rectangle = CGRectMake(60,170,200,80);
            CGContextAddRect(context, rectangle);
            CGContextStrokePath(context);
            CGContextSetFillColorWithColor(context,
                                           [UIColor redColor].CGColor);
            CGContextFillRect(context, rectangle);
            break;
        }
           
          ==> Here Drowing For Arc:-

        case DrawingArc:{
            CGContextRef context = UIGraphicsGetCurrentContext();
            CGContextSetLineWidth(context, 4.0);
            CGContextSetStrokeColorWithColor(context,
                                             [UIColor blueColor].CGColor);
            CGContextMoveToPoint(context, 100, 100);
            CGContextAddArcToPoint(context, 100,200, 300,200, 100);
            CGContextStrokePath(context);
            break;
        }
           
          ==> Here Drowing For Circle:-

        case DrawingCircle:{
            CGContextRef context = UIGraphicsGetCurrentContext();
            CGContextSetLineWidth(context, 4.0);
            CGContextSetStrokeColorWithColor(context,
                                             [UIColor blueColor].CGColor);
            CGRect rectangle = CGRectMake(60,170,200,80);
            CGContextAddEllipseInRect(context, rectangle);
            CGContextStrokePath(context);
            break;
        }
           
          ==> Here Drowing  For Cubic Curve:-


        case DrawingCubicCurve:{
            CGContextRef context = UIGraphicsGetCurrentContext();
            CGContextSetLineWidth(context, 4.0);
            CGContextSetStrokeColorWithColor(context,
                                             [UIColor blueColor].CGColor);
            CGContextMoveToPoint(context, 10, 10);
            CGContextAddCurveToPoint(context, 0, 50, 300, 250, 300, 400);
            CGContextStrokePath(context);
            break;
        }
           
            ==> Here Drowing  For Quadratic Curve:-

        case DrawingQuadraticCurve:{
            CGContextRef context = UIGraphicsGetCurrentContext();
            CGContextSetLineWidth(context, 4.0);
            CGContextSetStrokeColorWithColor(context,
                                             [UIColor blueColor].CGColor);
            CGContextMoveToPoint(context, 10, 200);
            CGContextAddQuadCurveToPoint(context, 150, 10, 300, 200);
            CGContextStrokePath(context);
            break;
        }
           
            ==> Here Drowing  For  Dash Line:-

        case DrawingDashLine:{
            CGContextRef context = UIGraphicsGetCurrentContext();
            CGContextSetLineWidth(context, 20.0);
            CGContextSetStrokeColorWithColor(context,
                                             [UIColor blueColor].CGColor);
            CGFloat dashArray[] = {2,6,4,2};
            CGContextSetLineDash(context, 3, dashArray, 4);
            CGContextMoveToPoint(context, 10, 200);
            CGContextAddQuadCurveToPoint(context, 150, 10, 300, 200);
            CGContextStrokePath(context);
            break;
        }
           
                    ==> Here Drowing  For Draw Shadow On Any Object:

        case DrawingShadow:{
            CGContextRef context = UIGraphicsGetCurrentContext();
           
            CGSize  myShadowOffset = CGSizeMake (-10,  15);
           
            CGContextSaveGState(context);
           
            CGContextSetShadow (context, myShadowOffset, 5);
           
            CGContextSetLineWidth(context, 4.0);
            CGContextSetStrokeColorWithColor(context,
                                             [UIColor blueColor].CGColor);
            CGRect rectangle = CGRectMake(60,170,200,80);
            CGContextAddEllipseInRect(context, rectangle);
            CGContextStrokePath(context);
            CGContextRestoreGState(context);
            break;
        }

          ==> Here Drowing   Draw CGImage:-

        case DrawingImage:{
            UIImage *myImage = [UIImage imageNamed:@"smiley-small.png"];
//            CGPoint imagePoint = CGPointMake(0, 0);
//            [myImage drawAtPoint:imagePoint];
//            CGRect imageRect =CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
//            [myImage drawInRect:imageRect];
            CGRect imageRect =CGRectMake(0, 0, self.frame.size.width, self.frame.size.height);
            [myImage drawInRect:imageRect blendMode:kCGBlendModeNormal alpha:1.0];
           
            //kCGBlendModeColor
            //Uses the luminance values of the background with the hue and saturation values of the source image. This mode preserves the gray levels in the image. You can use this mode to color monochrome images or to tint color images.
           
            break;
        }

           
        default:
            break;
    }
}


@end

How To Implement UIAnimation In Ios/Iphone



==> With The Diffrent Scale , Transform And Afferemative Animation :-Using UIAnimation

#import "ViewController.h"

@interface ViewController ()
=> Here Declared And Iboutelet Of UIView For UIAnimation:


@property (weak, nonatomic) IBOutlet UIView *viewOne;
@property (weak, nonatomic) IBOutlet UIView *viewTwo;
@property (weak, nonatomic) IBOutlet UIView *viewThree;
@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}


- (IBAction)btnMove:(id)sender {
   
    CGRect currentRct = _viewOne.frame;
    currentRct.origin.x =  250;
   
   
/==> User Simple Animation
    [UIView animateWithDuration:0.6 animations:^{
        _viewOne.frame = currentRct;
    }];

   
==> Used Animatiuon with Completion Handler:

//    [UIView animateWithDuration:0.6 animations:^{
//        _viewOne.frame = currentRct;
//        _viewTwo.backgroundColor = [UIColor blueColor];
//       
//        _viewOne.backgroundColor = [UIColor redColor];
//    } completion:^(BOOL finished) {
////        _viewOne.backgroundColor = [UIColor redColor];
//    }];

   
   
  ==> Here Used UIAnimation With Options:

//    [UIView animateWithDuration:0.6 delay:0.2 options:UIViewAnimationOptionCurveEaseOut animations:^{
//        _viewTwo.frame = currentRct;
//    } completion:nil];

   
   ==> Here Used Animation with Spring effect
//    [UIView animateWithDuration:0.6 delay:0.0 usingSpringWithDamping:0.5 initialSpringVelocity:1.0 options:1 animations:^{
//        _viewThree.frame = currentRct;
//    } completion:^(BOOL finished) {
//        NSLog(@"DONE");
//    }];

   
   
}


- (IBAction)btnRotate:(id)sender {

//    [UIView animateWithDuration:0.6 animations:^{
//        _viewThree.transform = CGAffineTransformRotate(_viewThree.transform, 3.14/2);
////        _viewThree.transform = CGAffineTransformMakeRotation(M_PI);
//    }];
   

    CGAffineTransform rotate =CGAffineTransformRotate(_viewThree.transform, 3.14/2);

    CGAffineTransform scale  = CGAffineTransformScale(_viewThree.transform, 1.5, 1.5);
   
   
    CGAffineTransform trans = CGAffineTransformTranslate(CGAffineTransformConcat(rotate, scale), 300, 300);
   
    [UIView beginAnimations:@"animationDemo" context:nil];
    [UIView setAnimationDelegate:self];
    [UIView setAnimationDuration:0.6];
   
    _viewThree.transform = trans;

   
    [UIView commitAnimations];
   
   
}
- (IBAction)btnScale:(id)sender {
   
   
    _viewTwo.transform = CGAffineTransformIdentity;
    [UIView animateWithDuration:0.6 animations:^{
      
//        _viewTwo.transform = CGAffineTransformScale(_viewTwo.transform, 2.0, 2.0);
       
       
//        _viewTwo.transform = CGAffineTransformTranslate(_viewTwo.transform, 10, -20);
       
       
//        _viewTwo.transform = CGAffineTransformMakeTranslation(40, 50);
//        _viewThree.transform = CGAffineTransformMakeScale(2.0, 2.0);
       
    }];
   
   
   
    //Alternate way
//    CGRect rect = _viewTwo.frame;
//    rect.size.height*=2;
//    rect.size.width*=2;
//   
//    CGPoint pntCenter = _viewTwo.center;
//   
//    [UIView animateWithDuration:0.5 animations:^{
//        _viewTwo.frame = rect;
//        _viewTwo.center = pntCenter;
//    }];
   
   
   
}


-(void)animationDidStart:(CAAnimation *)anim{
   
}

-(void)animationDidStop:(CAAnimation *)anim finished:(BOOL)flag{
   
}

@end

How To Use Audio Play Stop And Pause in Ios/Iphone

==> So  First of All Import Framwork AVFoundation

#import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h>

==> And ConfirmDelegete File Method OfAVAudioRecoreder:

@interface ViewController : UIViewController <AVAudioRecorderDelegate, AVAudioPlayerDelegate>

@property (weak, nonatomic) IBOutlet UIButton *recordPauseButton;
@property (weak, nonatomic) IBOutlet UIButton *stopButton;
@property (weak, nonatomic) IBOutlet UIButton *playButton;
@property (weak, nonatomic) IBOutlet UISlider *sliderCurrentSongValue;
@property (weak, nonatomic) IBOutlet UILabel *lblDuration;
@property (weak, nonatomic) IBOutlet UILabel *lblTotalDuration;

=> Here Declared Diffrent Action Method UIAction:-

- (IBAction)recordPauseTapped:(id)sender;
- (IBAction)stopTapped:(id)sender;
- (IBAction)playTapped:(id)sender;

@end

=> Implemnt File Some delegate and decalration fiield Action Method To Use-:

@interface ViewController () {
    AVAudioRecorder *recorder;
    AVAudioPlayer *player;
}

@end

@implementation ViewController
@synthesize stopButton, playButton, recordPauseButton;

- (void)viewDidLoad
{
    [super viewDidLoad];
   
    // Disable Stop/Play button when application launches
    [stopButton setEnabled:NO];
    [playButton setEnabled:NO];
   
    ==> Set the Audio file:-

    NSArray *pathComponents = [NSArray arrayWithObjects:
                               [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject],
                               @"MyAudioMemo.m4a",
                               nil];
    NSURL *outputFileURL = [NSURL fileURLWithPathComponents:pathComponents];

    /=>  Setup Audio Session

    AVAudioSession *session = [AVAudioSession sharedInstance];
    [session setCategory:AVAudioSessionCategoryPlayAndRecord error:nil];

    /==> / Define the Recorder Setting:-

    NSMutableDictionary *recordSetting = [[NSMutableDictionary alloc] init];
   
    [recordSetting setValue:[NSNumber numberWithInt:kAudioFormatMPEG4AAC] forKey:AVFormatIDKey];
    [recordSetting setValue:[NSNumber numberWithFloat:44100.0] forKey:AVSampleRateKey];
    [recordSetting setValue:[NSNumber numberWithInt: 2] forKey:AVNumberOfChannelsKey];
   
    //==>  Initiate And Prepare The Recorder:-

    recorder = [[AVAudioRecorder alloc] initWithURL:outputFileURL settings:recordSetting error:nil];
    recorder.delegate = self;
    recorder.meteringEnabled = YES;
    [recorder prepareToRecord];
}

==> Here Updated UI:
-
-(void)updateUI{
    _lblDuration.text = [NSString stringWithFormat:@"%.2f",player.currentTime];
    _sliderCurrentSongValue.value = player.currentTime;
}
- (IBAction)recordPauseTapped:(id)sender {
    // Stop the audio player before recording
    if (player.playing) {
        [player stop];
    }
   
    if (!recorder.recording) {
        AVAudioSession *session = [AVAudioSession sharedInstance];
        [session setActive:YES error:nil];
       
        // Start recording
        [recorder record];
        [recordPauseButton setTitle:@"Pause" forState:UIControlStateNormal];

    } else {

        // Pause recording
        [recorder pause];
        [recordPauseButton setTitle:@"Record" forState:UIControlStateNormal];
    }

    [stopButton setEnabled:YES];
    [playButton setEnabled:NO];
}

- (IBAction)stopTapped:(id)sender {
    [recorder stop];
   
    AVAudioSession *audioSession = [AVAudioSession sharedInstance];
    [audioSession setActive:NO error:nil];
}

- (IBAction)playTapped:(id)sender {
   //PLay recorded sound
  
    if (!recorder.recording){
        player = [[AVAudioPlayer alloc] initWithContentsOfURL:recorder.url error:nil];
        [player setDelegate:self];
        [player play];
        _lblTotalDuration.text = [NSString stringWithFormat:@"%f",player.duration];
        [_sliderCurrentSongValue setMaximumValue:player.duration];
        [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(updateUI) userInfo:nil repeats:YES];
    }
   
    //==> Here Use And Play Song From Bundle:-
//    [playButton setEnabled:YES];
//
//    NSURL *aUrlSong= [[NSBundle mainBundle] URLForResource:@"Bindass PLAY - Choti Choti Khushiyon [192kbps] [Songspkmp3.me]" withExtension:@"mp3"];
//    player = [[AVAudioPlayer alloc] initWithContentsOfURL:aUrlSong error:nil];
//    [player setDelegate:self];
//    [player play];
//    _lblTotalDuration.text = [NSString stringWithFormat:@"%.2f",player.duration];
//    [_sliderCurrentSongValue setMaximumValue:player.duration];
//    [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(updateUI) userInfo:nil repeats:YES];
}

==> Here Used Osme AvRecordd Delegete File Method Action:-AVAudioRecorderDelegate

#pragma mark - AVAudioRecorderDelegate

- (void) audioRecorderDidFinishRecording:(AVAudioRecorder *)avrecorder successfully:(BOOL)flag{
    [recordPauseButton setTitle:@"Record" forState:UIControlStateNormal];
    [stopButton setEnabled:NO];
    [playButton setEnabled:YES];   
}


#pragma mark - AVAudioPlayerDelegate

- (void) audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag{
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle: @"Done"
                               message: @"Finish playing the recording!"
                              delegate: nil
                     cancelButtonTitle:@"OK"
                     otherButtonTitles:nil];
    [alert show];
}


@end

How To Use Soap Wbservise Or Xml Parsing In Ios/Iphone

==>Use SOme File For xml reader  Implement :

#import <Foundation/Foundation.h>

enum {
    XMLReaderOptionsProcessNamespaces           = 1 << 0, // Specifies whether the receiver reports the namespace and the qualified name of an element.
    XMLReaderOptionsReportNamespacePrefixes     = 1 << 1, // Specifies whether the receiver reports the scope of namespace declarations.
    XMLReaderOptionsResolveExternalEntities     = 1 << 2, // Specifies whether the receiver reports declarations of external entities.
};
typedef NSUInteger XMLReaderOptions;

@interface XMLReader : NSObject <NSXMLParserDelegate>

+ (NSDictionary *)dictionaryForXMLData:(NSData *)data error:(NSError **)errorPointer;
+ (NSDictionary *)dictionaryForXMLString:(NSString *)string error:(NSError **)errorPointer;
+ (NSDictionary *)dictionaryForXMLData:(NSData *)data options:(XMLReaderOptions)options error:(NSError **)errorPointer;
+ (NSDictionary *)dictionaryForXMLString:(NSString *)string options:(XMLReaderOptions)options error:(NSError **)errorPointer;

@end
--------------------------------------------------------------------------------------------------------------------------------
#import "XMLReader.h"

#if !defined(__has_feature) || !__has_feature(objc_arc)
#error "XMLReader requires ARC support."
#endif

NSString *const kXMLReaderTextNodeKey        = @"text";
NSString *const kXMLReaderAttributePrefix    = @"@";

@interface XMLReader ()

@property (nonatomic, strong) NSMutableArray *dictionaryStack;
@property (nonatomic, strong) NSMutableString *textInProgress;
@property (nonatomic, strong) NSError *errorPointer;

@end


@implementation XMLReader

#pragma mark - Public methods

+ (NSDictionary *)dictionaryForXMLData:(NSData *)data error:(NSError **)error
{
    XMLReader *reader = [[XMLReader alloc] initWithError:error];
    NSDictionary *rootDictionary = [reader objectWithData:data options:0];
    return rootDictionary;
}

+ (NSDictionary *)dictionaryForXMLString:(NSString *)string error:(NSError **)error
{
    NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding];
    return [XMLReader dictionaryForXMLData:data error:error];
}

+ (NSDictionary *)dictionaryForXMLData:(NSData *)data options:(XMLReaderOptions)options error:(NSError **)error
{
    XMLReader *reader = [[XMLReader alloc] initWithError:error];
    NSDictionary *rootDictionary = [reader objectWithData:data options:options];
    return rootDictionary;
}

+ (NSDictionary *)dictionaryForXMLString:(NSString *)string options:(XMLReaderOptions)options error:(NSError **)error
{
    NSData *data = [string dataUsingEncoding:NSUTF8StringEncoding];
    return [XMLReader dictionaryForXMLData:data options:options error:error];
}


#pragma mark - Parsing

- (id)initWithError:(NSError **)error
{
    self = [super init];
    if (self)
    {
        self.errorPointer = *error;
    }
    return self;
}

- (NSDictionary *)objectWithData:(NSData *)data options:(XMLReaderOptions)options
{
    // Clear out any old data
    self.dictionaryStack = [[NSMutableArray alloc] init];
    self.textInProgress = [[NSMutableString alloc] init];
   
    // Initialize the stack with a fresh dictionary
    [self.dictionaryStack addObject:[NSMutableDictionary dictionary]];
   
    // Parse the XML
    NSXMLParser *parser = [[NSXMLParser alloc] initWithData:data];
   
    [parser setShouldProcessNamespaces:(options & XMLReaderOptionsProcessNamespaces)];
    [parser setShouldReportNamespacePrefixes:(options & XMLReaderOptionsReportNamespacePrefixes)];
    [parser setShouldResolveExternalEntities:(options & XMLReaderOptionsResolveExternalEntities)];
   
    parser.delegate = self;
    BOOL success = [parser parse];
   
    // Return the stack's root dictionary on success
    if (success)
    {
        NSDictionary *resultDict = [self.dictionaryStack objectAtIndex:0];
        return resultDict;
    }
   
    return nil;
}


#pragma mark -  NSXMLParserDelegate methods

- (void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName attributes:(NSDictionary *)attributeDict
{  
    // Get the dictionary for the current level in the stack
    NSMutableDictionary *parentDict = [self.dictionaryStack lastObject];

    // Create the child dictionary for the new element, and initilaize it with the attributes
    NSMutableDictionary *childDict = [NSMutableDictionary dictionary];
    [childDict addEntriesFromDictionary:attributeDict];
   
    // If there's already an item for this key, it means we need to create an array
    id existingValue = [parentDict objectForKey:elementName];
    if (existingValue)
    {
        NSMutableArray *array = nil;
        if ([existingValue isKindOfClass:[NSMutableArray class]])
        {
            // The array exists, so use it
            array = (NSMutableArray *) existingValue;
        }
        else
        {
            // Create an array if it doesn't exist
            array = [NSMutableArray array];
            [array addObject:existingValue];

            // Replace the child dictionary with an array of children dictionaries
            [parentDict setObject:array forKey:elementName];
        }
       
        // Add the new child dictionary to the array
        [array addObject:childDict];
    }
    else
    {
        // No existing value, so update the dictionary
        [parentDict setObject:childDict forKey:elementName];
    }
   
    // Update the stack
    [self.dictionaryStack addObject:childDict];
}

- (void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
{
    // Update the parent dict with text info
    NSMutableDictionary *dictInProgress = [self.dictionaryStack lastObject];
   
    // Set the text property
    if ([self.textInProgress length] > 0)
    {
        // trim after concatenating
        NSString *trimmedString = [self.textInProgress stringByTrimmingCharactersInSet:[NSCharacterSet whitespaceAndNewlineCharacterSet]];
        [dictInProgress setObject:[trimmedString mutableCopy] forKey:kXMLReaderTextNodeKey];

        // Reset the text
        self.textInProgress = [[NSMutableString alloc] init];
    }
   
    // Pop the current dict
    [self.dictionaryStack removeLastObject];
}

- (void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string
{
    // Build the text value
    [self.textInProgress appendString:string];
}

- (void)parser:(NSXMLParser *)parser parseErrorOccurred:(NSError *)parseError
{
    // Set the error pointer to the parser's error object
    self.errorPointer = parseError;
}

@end

==> Now Use Create ViewController Or Class For Parsing Of Xml Parsing Using Xml Reader:-

--------------------Now take ViewController With Some Field And IBAction------------------------
=> First Import Reader Of Xml Reader:-

#import <UIKit/UIKit.h>
#import "XMLReader.h"

@interface ViewController : UIViewController{
    BOOL recordResults;
}
@property (weak, nonatomic) IBOutlet UITextField *txtFromCountryCode;
@property (weak, nonatomic) IBOutlet UITextField *txtToCountryCode;
@property (weak, nonatomic) IBOutlet UILabel *lblResult;

@property(nonatomic, strong) NSMutableData *webData;
@property(nonatomic, strong) NSMutableString *soapResults;
@property(nonatomic, strong) NSXMLParser *xmlParser;
@property (weak, nonatomic) IBOutlet UILabel *lblError;
-(IBAction)btnConvertClick: (id) sender;
@end


-------------------------------------
#import "ViewController.h"

@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

-(IBAction)btnConvertClick:(id)sender
{
    recordResults = FALSE;
   
    NSString *soapMessage = [NSString stringWithFormat:
                             @"<?xml version=\"1.0\" encoding=\"utf-8\"?>"
                             "<soap:Envelope xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\" xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\">"
                             "<soap:Body>"
                             "<ConversionRate xmlns=\"http://www.webserviceX.NET/\">"
                             "<FromCurrency>%@</FromCurrency>"
                             "<ToCurrency>%@</ToCurrency>"
                             "</ConversionRate>"
                             "</soap:Body>"
                             "</soap:Envelope>", self.txtFromCountryCode.text,self.txtToCountryCode.text
                             ];
    NSLog(@"Soap Message = %@",soapMessage);
   
    NSURL *url = [NSURL URLWithString:@"http://www.webservicex.net/CurrencyConvertor.asmx"];
    NSMutableURLRequest *theRequest = [NSMutableURLRequest requestWithURL:url];
    NSString *msgLength = [NSString stringWithFormat:@"%lu", (unsigned long)[soapMessage length]];
   
    [theRequest addValue: @"text/xml; charset=utf-8" forHTTPHeaderField:@"Content-Type"];
    [theRequest addValue: @"http://www.webserviceX.NET/ConversionRate" forHTTPHeaderField:@"SOAPAction"];
    [theRequest addValue: msgLength forHTTPHeaderField:@"Content-Length"];
    [theRequest setHTTPMethod:@"POST"];
    [theRequest setHTTPBody: [soapMessage dataUsingEncoding:NSUTF8StringEncoding]];
   
    NSURLConnection *theConnection = [[NSURLConnection alloc] initWithRequest:theRequest delegate:self];
   
    if( theConnection )
    {
        self.webData = [NSMutableData data];
    }
    else
    {
        NSLog(@"theConnection is NULL");
    }
   
    [self.txtFromCountryCode resignFirstResponder];
    [self.txtToCountryCode resignFirstResponder];
   
}

-(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
    [self.webData setLength: 0];
}
-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
    [self.webData appendData:data];
}
-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{
    NSLog(@"ERROR with theConenction");
    self.lblError.text = [error description];
}
-(void)connectionDidFinishLoading:(NSURLConnection *)connection
{
    NSLog(@"DONE. Received Bytes: %lu", (unsigned long)[self.webData length]);
    NSString *theXML = [[NSString alloc] initWithBytes: [self.webData mutableBytes] length:[self.webData length] encoding:NSUTF8StringEncoding];
   
    NSLog(@"%@",theXML);
    //For Direct get Dictionary From Classes
   
    NSError *error;
    NSDictionary *dictResponce = [XMLReader dictionaryForXMLString:theXML error:&error];
    NSLog(@"Dictionary = %@",dictResponce);
    self.lblResult.text = [NSString stringWithFormat:@"Converted value : %@",[[[[[dictResponce objectForKey:@"soap:Envelope"] objectForKey:@"soap:Body"] objectForKey:@"ConversionRateResponse"] objectForKey:@"ConversionRateResult"] objectForKey:@"text"]];
   
//    self.xmlParser = [[NSXMLParser alloc] initWithData: self.webData];
//    [self.xmlParser setDelegate: (id)self];
//    [self.xmlParser setShouldResolveExternalEntities: YES];
//    [self.xmlParser parse];
}
==> Here Used Some Delegate Method And Xml :

//-(void)parser:(NSXMLParser *)parser didStartElement:(NSString *)elementName namespaceURI:(NSString *) namespaceURI qualifiedName:(NSString *)qName
//   attributes: (NSDictionary *)attributeDict
//{
//    if( [elementName isEqualToString:@"HelloResult"])
//    {
//        if(!self.soapResults)
//        {
//            self.soapResults = [[NSMutableString alloc] init];
//        }
//        recordResults = TRUE;
//    }
//}
//-(void)parser:(NSXMLParser *)parser foundCharacters:(NSString *)string
//{
//    NSLog(@"String Result ==%@",string);
//    self.lblResult.text = string;
//    if( recordResults )
//    {
//        [self.soapResults appendString: string];
//    }
//}
//-(void)parser:(NSXMLParser *)parser didEndElement:(NSString *)elementName namespaceURI:(NSString *)namespaceURI qualifiedName:(NSString *)qName
//{
//    if( [elementName isEqualToString:@"HelloResult"])
//    {
//        recordResults = FALSE;
//        self.lblResult.text = self.soapResults;
//        self.soapResults = nil;
//    }
//}


@end

how to use json response and request

#import <UIKit/UIKit.h>

@interface ViewController : UIViewController<NSURLConnectionDelegate>
{
    __weak IBOutlet UITextView *txtDisplay;
    NSMutableData *responseData;
}
@property (weak, nonatomic) IBOutlet UIActivityIndicatorView *actLoading;

- (IBAction)CallWSBtnClick:(UIButton *)sender;

@end
===========================
@implementation ViewController

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
}



- (IBAction)CallWSBtnClick:(UIButton *)sender
{
    // Get Data
   
//    NSURL *aURL = [NSURL URLWithString:@"http://rest-service.guides.spring.io/greeting"];
//    NSURLRequest *aRequest = [NSURLRequest requestWithURL:aURL];
//    NSURLResponse *aResponse = nil;
//    NSError *aError = nil;

    // Synchronous Get Data
   

//    responseData = [[NSURLConnection sendSynchronousRequest:aRequest returningResponse:&aResponse error:&aError] mutableCopy];
//   
//    if (!aError)
//    {
//        txtDisplay.text = [NSString stringWithFormat:@"%@",[NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableContainers error:nil]];
//    }
   
    // Asynchronous Get Data Without Block
   
    // *** Note : Don't Use This Method For InLine WebService Call(Like | Comment | Report Abuse) ***
   
//    NSData *responceData = [NSURLConnection sendSynchronousRequest:aRequest returningResponse:&aResponse error:&aError];
//    if (responceData.length>0 && aError == nil) {
//        txtDisplay.text = [NSString stringWithFormat:@"%@",[NSJSONSerialization JSONObjectWithData:responceData options:NSJSONReadingMutableContainers error:nil]];
//    }
    // Asynchronous Get Data With Block
   
    // *** Note : Must Use This Method For InLine WebService Call(Like | Comment | Report Abuse) ***
   
//    [NSURLConnection sendAsynchronousRequest:aRequest queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError)
//    {
//        if (data.length > 0 && connectionError == nil)
//        {
//            txtDisplay.text = [NSString stringWithFormat:@"%@",[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil]];
//        }
//    }];

   
    // Post Data
   
//    NSURL *aURL = [NSURL URLWithString:@"http://staging.indianic.com/lightning/public/web_service/client.php?method=skiplogin"];
//    NSString *strBody = @"post_data_string={\"device_id\":\"123\",\"device_type\":\"Android\",\"device_token\":\"8e310af31620ed310bfad3839c2f18130324a8c7f30739760ba60f56d8c93bae\"}";
//   
//    NSMutableURLRequest *aMutRequest = [[NSMutableURLRequest alloc]initWithURL:aURL cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:20.0];
//    [aMutRequest setHTTPMethod:@"POST"];
//    [aMutRequest setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
//    [aMutRequest setHTTPBody:[NSData dataWithBytes:[strBody UTF8String] length:strlen([strBody UTF8String])]];
    //[NSURLConnection connectionWithRequest:aMutRequest delegate:self];
   
    NSURL *aURL = [NSURL URLWithString:@"http://www.izilunch.se/service/WebService/Service.svc/UpdateStatusOfpushNotification"];
   
    NSMutableDictionary *aDict = [[NSMutableDictionary alloc]init];
    [aDict setValue:@"8e310af31620ed310bfad3839c2f18130324a8c7f30739760ba60f56d8c93bae" forKey:@"deviceid"];
    [aDict setValue:@"0" forKey:@"status"];

    NSData *aData = [NSJSONSerialization dataWithJSONObject:aDict options:NSJSONWritingPrettyPrinted error:nil];
   
    NSMutableURLRequest *aMutRequest = [[NSMutableURLRequest alloc]initWithURL:aURL cachePolicy:NSURLRequestUseProtocolCachePolicy timeoutInterval:20.0];
    [aMutRequest setHTTPMethod:@"POST"];
    [aMutRequest setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
    [aMutRequest setHTTPBody:aData];
    [aMutRequest setValue:[NSString stringWithFormat:@"%lu",(unsigned long)[aData length]] forHTTPHeaderField:@"Content-Length"];
   
    [self.actLoading startAnimating];
   
//    [NSURLConnection connectionWithRequest:aMutRequest delegate:self];
   
    [NSURLConnection sendAsynchronousRequest:aMutRequest queue:[NSOperationQueue mainQueue] completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError)
     {
         if (data.length > 0 && connectionError == nil)
         {
             txtDisplay.text = [NSString stringWithFormat:@"%@",[NSJSONSerialization JSONObjectWithData:data options:NSJSONReadingMutableContainers error:nil]];
                [self.actLoading stopAnimating];
         }
     }];
   

}

#pragma mark NSURLConnection Delegate Methods

- (void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response
{
    // A response has been received, this is where we initialize the instance var you created
    // so that we can append data to it in the didReceiveData method
    // Furthermore, this method is called each time there is a redirect so reinitializing it
    // also serves to clear it
    responseData = [[NSMutableData alloc] init];
}

- (void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data
{
    // Append the new data to the instance variable you declared
    [responseData appendData:data];
}

- (NSCachedURLResponse *)connection:(NSURLConnection *)connection
                  willCacheResponse:(NSCachedURLResponse*)cachedResponse
{
    // Return nil to indicate not necessary to store a cached response for this connection
    return nil;
}

- (void)connectionDidFinishLoading:(NSURLConnection *)connection
{
    // The request is complete and data has been received
    // You can parse the stuff in your instance variable now
    [self.actLoading stopAnimating];
    txtDisplay.text = [NSString stringWithFormat:@"%@",[NSJSONSerialization JSONObjectWithData:responseData options:NSJSONReadingMutableContainers error:nil]];
   
}

- (void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error
{
    // The request has failed for some reason!
    // Check the error var
}

@end

How To Use Audio Play Stop And Pause Like Music Player In Ios/iphone

==> So First of All Import Framwork AVFoundation:-

#import <UIKit/UIKit.h>
#import <AVFoundation/AVFoundation.h>

@interface ViewController : UIViewController <AVAudioRecorderDelegate, AVAudioPlayerDelegate>

@property (weak, nonatomic) IBOutlet UIButton *recordPauseButton;
@property (weak, nonatomic) IBOutlet UIButton *stopButton;
@property (weak, nonatomic) IBOutlet UIButton *playButton;
@property (weak, nonatomic) IBOutlet UISlider *sliderCurrentSongValue;
@property (weak, nonatomic) IBOutlet UILabel *lblDuration;
@property (weak, nonatomic) IBOutlet UILabel *lblTotalDuration;


==> Declared IBAction Of Play Pause and Record:

- (IBAction)recordPauseTapped:(id)sender;
- (IBAction)stopTapped:(id)sender;
- (IBAction)playTapped:(id)sender;

@end

implemnt file some delegate and decalration fiield action method to use:

@interface ViewController () {
    AVAudioRecorder *recorder;
    AVAudioPlayer *player;
}

@end

@implementation ViewController
@synthesize stopButton, playButton, recordPauseButton;

- (void)viewDidLoad
{
    [super viewDidLoad];
   
    // Disable Stop/Play button when application launches
    [stopButton setEnabled:NO];
    [playButton setEnabled:NO];
   
    //==>  Set The Audio file Using AvAudioPlayer:
    NSArray *pathComponents = [NSArray arrayWithObjects:
                               [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject],
                               @"MyAudioMemo.m4a",
                               nil];
    NSURL *outputFileURL = [NSURL fileURLWithPathComponents:pathComponents];

    // ==> Setup Audio Session ==  AVAudioSwession:

    AVAudioSession *session = [AVAudioSession sharedInstance];
    [session setCategory:AVAudioSessionCategoryPlayAndRecord error:nil];

    //==>  Define The Recorder Setting
    NSMutableDictionary *recordSetting = [[NSMutableDictionary alloc] init];
   
    [recordSetting setValue:[NSNumber numberWithInt:kAudioFormatMPEG4AAC] forKey:AVFormatIDKey];
    [recordSetting setValue:[NSNumber numberWithFloat:44100.0] forKey:AVSampleRateKey];
    [recordSetting setValue:[NSNumber numberWithInt: 2] forKey:AVNumberOfChannelsKey];
   
    //==> Initiate And Prepare The Recorder:-AVAudioRecorder

    recorder = [[AVAudioRecorder alloc] initWithURL:outputFileURL settings:recordSetting error:nil];
    recorder.delegate = self;
    recorder.meteringEnabled = YES;
    [recorder prepareToRecord];
}
==> Updated UI:-

-(void)updateUI{
    _lblDuration.text = [NSString stringWithFormat:@"%.2f",player.currentTime];
    _sliderCurrentSongValue.value = player.currentTime;
}
- (IBAction)recordPauseTapped:(id)sender {
    // Stop the audio player before recording
    if (player.playing) {
        [player stop];
    }
   
    if (!recorder.recording) {
        AVAudioSession *session = [AVAudioSession sharedInstance];
        [session setActive:YES error:nil];
       
        // Start recording
        [recorder record];
        [recordPauseButton setTitle:@"Pause" forState:UIControlStateNormal];

    } else {

        // Pause recording
        [recorder pause];
        [recordPauseButton setTitle:@"Record" forState:UIControlStateNormal];
    }

    [stopButton setEnabled:YES];
    [playButton setEnabled:NO];
}

==> Stop Recording IBAction:-

- (IBAction)stopTapped:(id)sender {
    [recorder stop];
   
    AVAudioSession *audioSession = [AVAudioSession sharedInstance];
    [audioSession setActive:NO error:nil];
}

=> Play Recording IBAction Used:-

- (IBAction)playTapped:(id)sender {
   //PLay recorded sound
  
    if (!recorder.recording){
        player = [[AVAudioPlayer alloc] initWithContentsOfURL:recorder.url error:nil];
        [player setDelegate:self];
        [player play];
        _lblTotalDuration.text = [NSString stringWithFormat:@"%f",player.duration];
        [_sliderCurrentSongValue setMaximumValue:player.duration];
        [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(updateUI) userInfo:nil repeats:YES];
    }
   
    //Play song from bundle
//    [playButton setEnabled:YES];
//
//    NSURL *aUrlSong= [[NSBundle mainBundle] URLForResource:@"Bindass PLAY - Choti Choti Khushiyon [192kbps] [Songspkmp3.me]" withExtension:@"mp3"];
//    player = [[AVAudioPlayer alloc] initWithContentsOfURL:aUrlSong error:nil];
//    [player setDelegate:self];
//    [player play];
//    _lblTotalDuration.text = [NSString stringWithFormat:@"%.2f",player.duration];
//    [_sliderCurrentSongValue setMaximumValue:player.duration];
//    [NSTimer scheduledTimerWithTimeInterval:0.5 target:self selector:@selector(updateUI) userInfo:nil repeats:YES];
}

==> Here Some AVAudioRecorederDeleget Used For AVAudioFoundation:-
#pragma mark - AVAudioRecorderDelegate

- (void) audioRecorderDidFinishRecording:(AVAudioRecorder *)avrecorder successfully:(BOOL)flag{
    [recordPauseButton setTitle:@"Record" forState:UIControlStateNormal];
    [stopButton setEnabled:NO];
    [playButton setEnabled:YES];   
}
=> Used And Implement AVAudioPlayed Delegate
#pragma mark - AVAudioPlayerDelegate

- (void) audioPlayerDidFinishPlaying:(AVAudioPlayer *)player successfully:(BOOL)flag{
    UIAlertView *alert = [[UIAlertView alloc] initWithTitle: @"Done"
                               message: @"Finish playing the recording!"
                              delegate: nil
                     cancelButtonTitle:@"OK"
                     otherButtonTitles:nil];
    [alert show];
}


@end

Use With UIPickerView And Its Source Type GalaryView In Ios/Iphone

=> Confirm Protocol Of UIimagePickerControllerDelegate:

@interface ViewController : UIViewController<UIImagePickerControllerDelegate, UINavigationControllerDelegate>

@property (weak, nonatomic) IBOutlet UIImageView *imgView;

@end

------------------------------
@interface ViewController ()

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];

==> Here UIimage With NSData Used NSUrl:
   
    UIImage *img =[UIImage imageWithData:[NSData dataWithContentsOfURL:[NSURL URLWithString:@"https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEjN0jOr9aVt9g1OIB-lfSO2lBBPvzO_I06eJ_i2x6y1TP1kPqM1t7ND_krBXO2600wwH38jrmaMpnISR2WAk6CMblXQOKsjgCqxoXC-YjG4EJIop6vN_omvttVxvrAE2gANyXv_iYA51Rk/s1600/1.png"]]];
    _imgView.image = img;
    // Do any additional setup after loading the view, typically from a nib.
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

=> To Take Photo Action From Camera:

- (IBAction)btnTakePhotoAction:(id)sender {
    [self takePhotoMode:YES];
}
=> This Method Used For Load From GelleryView  Action In UIImagePicker:

- (IBAction)btnLoadFromGallaryAction:(id)sender {
    [self takePhotoMode:NO];
}

=> To Take Photo Mode And Check Source Type in ImagePIcker:

-(void)takePhotoMode:(BOOL)isFromCamera{
   
    if (isFromCamera && ![UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
       
        UIAlertView *myAlertView = [[UIAlertView alloc] initWithTitle:@"Error"
                                                              message:@"Device has no camera"
                                                             delegate:nil
                                                    cancelButtonTitle:@"OK"
                                                    otherButtonTitles: nil];
       
        [myAlertView show];
        return;
       
    }
   
    UIImagePickerController *picker = [[UIImagePickerController alloc] init];
    picker.delegate = self;
    picker.allowsEditing = YES;
    picker.sourceType = isFromCamera?UIImagePickerControllerSourceTypeCamera:UIImagePickerControllerSourceTypePhotoLibrary;
    [self presentViewController:picker animated:YES completion:NULL];
   
}
==> Used For UIImagePickerDelegate Method And Action:-

#pragma mark - Image Picker Controller delegate methods

- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
   
    UIImage *chosenImage = info[UIImagePickerControllerEditedImage];
    UIImage *origionalImage = [info objectForKey:UIImagePickerControllerOriginalImage];
   
   
   
    self.imgView.image = chosenImage;
    [picker dismissViewControllerAnimated:YES completion:NULL];
   
   
    [self saveImageToDouments:chosenImage];
   
}
==> Used For Save Image TO Document In UiImagePickerController:-

-(void)saveImageToDouments:(UIImage*)image{
    NSString *aStrDoc =NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES).lastObject;
   
    NSString *fullPath = [aStrDoc stringByAppendingPathComponent:@"sample.jpg"];
   
    NSData *imgData = UIImageJPEGRepresentation(image, 0.8);
    [imgData writeToFile:fullPath atomically:YES];
   
   
}
=> Use Action For Save Image In Gallery Using UIIMagePIckerController:-

-(void)saveImageToGallary:(UIImage*)image{
    UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil);
}
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {   

    [picker dismissViewControllerAnimated:YES completion:NULL];
   
}


@end

How to work Gesture Recognization in Ios/Iphone

==> Here See Some Gesture like long Gsture , pin Gesture tap Gesture:
=> Used And Import Gesture Like  ;-UIGestureRecognizerDelegate

#import "ViewController.h"

@interface ViewController ()<UIGestureRecognizerDelegate>
@property (weak, nonatomic) IBOutlet UIView *viewSender;

@end

@implementation ViewController

- (void)viewDidLoad {
    [super viewDidLoad];
   
    UIRotationGestureRecognizer *aRotationGesture = [[UIRotationGestureRecognizer alloc]initWithTarget:self action:@selector(rotateView:)];
    aRotationGesture.delegate =self;
    [_viewSender addGestureRecognizer:aRotationGesture];
   
==> Used Here PinchGestureRecognization:

    UIPinchGestureRecognizer *aPinch = [[UIPinchGestureRecognizer alloc]initWithTarget:self  action:@selector(pinchView:)];
    aPinch.delegate =self;
    [_viewSender addGestureRecognizer:aPinch];   
 
    // Do any additional setup after loading the view, typically from a nib.
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
-(void)rotateView:(UIRotationGestureRecognizer*)sender{
    _viewSender.transform = CGAffineTransformRotate(_viewSender.transform, sender.rotation);
    [sender setRotation:0];
}

-(void)pinchView:(UIPinchGestureRecognizer*)sender{
    _viewSender.transform = CGAffineTransformScale(_viewSender.transform, sender.scale, sender.scale);
    [sender setScale:1];
}
==> Here Use Gesture Delegate Of Pinchand Recognization Of Gesture Used:

#pragma mark - Delegates
- (BOOL)gestureRecognizer:(UIGestureRecognizer *)gestureRecognizer shouldRecognizeSimultaneouslyWithGestureRecognizer:(UIGestureRecognizer *)otherGestureRecognizer{

    return YES;
}
==> Used Some Gesture Using Swipe Gesture Recoganization:-

- (IBAction)swipeHandler:(UISwipeGestureRecognizer*)sender {
   
    switch (sender.direction) {
        case UISwipeGestureRecognizerDirectionDown:
        {   NSLog(@"DOWN");
            break;
        }
        case UISwipeGestureRecognizerDirectionRight:
            NSLog(@"RGHT");
            break;
        default:
            break;
    }
}
@end

How To Use Custom Cell In UITableViewCell In UITableView Ios/Iphone

==> First Create File Of Inherited From UItableViewCell:
 
@interface CustomCell : UITableViewCell
{
   
}

@property (weak, nonatomic) IBOutlet UIImageView *imgViewThumb;
@property (weak, nonatomic) IBOutlet UILabel *lblName;

@property (nonatomic, strong) NSIndexPath *indexPath;

- (IBAction)btnTapped:(UIButton *)sender;

@end

-------------------------------

#import "CustomCell.h"

@implementation CustomCell

- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

- (IBAction)btnTapped:(UIButton *)sender
{
    NSLog(@"Button clicked for row at index :%lu", self.indexPath.row);
}

@end

---------------------This Custom Cell Use MainView Controller In Where Used UITableView As CellForRowtAtIndexpath  IN Delegete Method-
:
                                 ==>  Data Sources Method: UITableView
- (UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    CustomCell *aTblCell = (CustomCell *) [tableView dequeueReusableCellWithIdentifier:@"CellOne" forIndexPath:indexPath];
    aTblCell.indexPath = indexPath;
   
    NSDictionary *aDictStudInfo = (NSDictionary *) [mutArrStudents objectAtIndex:indexPath.row];
   
    if(indexPath.row % 2 == 0)
    {
        aTblCell.imgViewThumb.image = [UIImage imageNamed:@"a.png"];
    }
    else
    {
        aTblCell.imgViewThumb.image = [UIImage imageNamed:@"b.png"];
    }
   
    //aTblCell.lblName.text = [NSString stringWithFormat:@"ROW NUMBER :%lu", indexPath.row];
    aTblCell.lblName.text = [aDictStudInfo objectForKey:@"name"];
   
    return aTblCell;
}

                                 ==>  Delegate Method: UITableView
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSDictionary *aDictStudentInfo = (NSDictionary *) [mutArrStudents objectAtIndex:indexPath.row];
    NSLog(@"%@", aDictStudentInfo);
    [self performSegueWithIdentifier:@"showDetail" sender:aDictStudentInfo];
}

How To Use Refresh Controll on Refresh data PullToRefresh In Ios/Iphone

=> First Use Declared IBoutlet Of RefreshControll:-

- (void)viewDidLoad
{
    [super viewDidLoad];
    // Do any additional setup after loading the view, typically from a nib.
    //[tblViewData setEditing:YES animated:YES];
   
    refreshControl = [[UIRefreshControl alloc] init];
    [refreshControl setTintColor:[UIColor orangeColor]];
    [refreshControl setAttributedTitle:[[NSAttributedString alloc] initWithString:@"Pull down to refresh..."]];
    [refreshControl addTarget:self action:@selector(refreshData) forControlEvents:UIControlEventValueChanged];
   
    [tblViewData addSubview:refreshControl];
}
==> Uisng This Method refresh Some Data Of UITableView:-

- (void)refreshData
{
    [refreshControl setAttributedTitle:[[NSAttributedString alloc] initWithString:@"Please wait..."]];
   
    [self performSelector:@selector(stopRefreshControl) withObject:nil afterDelay:5.0];
}

- (void)stopRefreshControl
{
    if(refreshControl.isRefreshing)
    {
        [refreshControl endRefreshing];
        [refreshControl setAttributedTitle:[[NSAttributedString alloc] initWithString:@"Pull down to refresh..."]];
    }
}

Work With UITableView Delegate Method Swipe Dlete And Insert CommitEditingStyle In Ios/iphone


==> Using Some swipe Delete  And Insert Item Using This UITableViewDelegate :-

- (UITableViewCellEditingStyle)tableView:(UITableView *)tableView editingStyleForRowAtIndexPath:(NSIndexPath *)indexPath
{
    if(indexPath.row == 0)
    {
        return UITableViewCellEditingStyleInsert;
    }
    else if(indexPath.row == 1)
    {
        return UITableViewCellEditingStyleDelete;
    }
   
    return UITableViewCellEditingStyleNone;
}

==> Used Insert And Delete In UITableView :-

- (void)tableView:(UITableView *)tableView commitEditingStyle:(UITableViewCellEditingStyle)editingStyle forRowAtIndexPath:(NSIndexPath *)indexPath
{
    if(editingStyle == UITableViewCellEditingStyleDelete)
    {
        NSLog(@"Delete action performed for row - %lu", indexPath.row);
    }
    else if(editingStyle == UITableViewCellEditingStyleInsert)
    {
        NSLog(@"Insert action performed for row - %lu", indexPath.row);
    }
}

How to work with Mail and Sms In Ios

#import <UIKit/UIKit.h>
#import <MessageUI/MessageUI.h>



@interface ViewController : UIViewController<MFMailComposeViewControllerDelegate,MFMessageComposeViewControllerDelegate >

@property (weak, nonatomic) IBOutlet UIButton *btnSendMail;
@property (weak, nonatomic) IBOutlet UIButton *btnSendSMS;

- (IBAction)btnSendMailClick:(id)sender;
- (IBAction)btnSendSMSClick:(id)sender;

- (IBAction)btnSendSMSOutSideAppClick:(id)sender;

@end



-----------------------------------------------------------------------------------
- (IBAction)btnSendMailClick:(id)sender {
    if ([MFMailComposeViewController canSendMail])
    {
        MFMailComposeViewController *mail = [[MFMailComposeViewController alloc] init];
       
        mail.mailComposeDelegate = (id)self;
        [mail setSubject:@"Your Mail Subject"];
        [mail setMessageBody:@"Here is some main text in the email!" isHTML:NO];
        [mail setToRecipients:@[@"dhanesh.gosai@indianic.com",@"test@gmail.com"]];
       
        //For Attachment File In mail.
        //Media Type http://www.iana.org/assignments/media-types/media-types.txt
        NSData *fileData = [NSData dataWithContentsOfFile:[[NSBundle mainBundle] pathForResource:@"pdf-sample" ofType:@"pdf"]];
        [mail addAttachmentData:fileData mimeType:@"application/pdf" fileName:@"MySample.pdf"];
       
        [self presentViewController:mail animated:YES completion:NULL];
    }
    else
    {
        NSLog(@"This device cannot send email");
    }
}

#pragma mark MFMailComposeViewControllerDelegate methods

- (void)mailComposeController:(MFMailComposeViewController *)controller didFinishWithResult:(MFMailComposeResult)result error:(NSError *)error{
    switch (result) {
        case MFMailComposeResultSent:
            NSLog(@"You sent the email.");
            break;
        case MFMailComposeResultSaved:
            NSLog(@"You saved a draft of this email");
            break;
        case MFMailComposeResultCancelled:
            NSLog(@"You cancelled sending this email.");
            break;
        case MFMailComposeResultFailed:
            NSLog(@"Mail failed:  An error occurred when trying to compose this email");
            break;
        default:
            NSLog(@"An error occurred when trying to compose this email");
            break;
    }
   
    [self dismissViewControllerAnimated:YES completion:NULL];
}

- (IBAction)btnSendSMSClick:(id)sender {
//    InSide the app
    if(![MFMessageComposeViewController canSendText]) {
        UIAlertView *warningAlert = [[UIAlertView alloc] initWithTitle:@"Error" message:@"Your device doesn't support SMS!" delegate:nil cancelButtonTitle:@"OK" otherButtonTitles:nil];
        [warningAlert show];
        return;
    }
   
    NSArray *recipents = @[@"12345678", @"72345524"];
    NSString *message = [NSString stringWithFormat:@"Just Check Message form My APP"];
   
    MFMessageComposeViewController *messageController = [[MFMessageComposeViewController alloc] init];
    messageController.messageComposeDelegate = self;
    [messageController setRecipients:recipents];
    [messageController setBody:message];
   
    // Present message view controller on screen
    [self presentViewController:messageController animated:YES completion:nil];

}

- (IBAction)btnSendSMSOutSideAppClick:(id)sender {
//    Out Side App
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:@"sms:9408003812"]];
   
}

#pragma mark MFMessageComposeViewController methods

- (void)messageComposeViewController:(MFMessageComposeViewController *)controller didFinishWithResult:(MessageComposeResult)result{
    switch (result) {
        case MessageComposeResultSent:
            NSLog(@"You sent the message.");
            break;
        case MessageComposeResultFailed:
            NSLog(@"Message failed:  An error occurred when trying to compose this message");
            break;
        case MessageComposeResultCancelled:
            NSLog(@"You cancelled sending this message.");
            break;
        default:
            NSLog(@"An error occurred when trying to compose this email");
            break;
    }
   
    [self dismissViewControllerAnimated:YES completion:NULL];
}

How To Work Audio Recoreder and video Play From Youtube Ios/iphone

=> Here First Use Importing MediaPlayed:

=> Uisng MPMoviePlayerController:-

#import <UIKit/UIKit.h>
#import <MediaPlayer/MediaPlayer.h>


@interface ViewController : UIViewController<MFMailComposeViewControllerDelegate,MFMessageComposeViewControllerDelegate >
@property (strong, nonatomic) MPMoviePlayerController *moviePlayer;


@property (weak, nonatomic) IBOutlet UIButton *btnPlayVideo;


- (IBAction)btnPlayVideoClick:(id)sender;
- (IBAction)btnSendSMSOutSideAppClick:(id)sender;
- (IBAction)btnPlayLiveVideoClick:(id)sender;
@end


 -----------------------------use some methor Or Action on Play video and recording
==> Used Method Or Action For Play And Recording:

==> This Method For PlayingVidio:

- (IBAction)btnPlayVideoClick:(id)sender {

   
    //==> Using Local NSBunndle Resourced Used File Path:

    NSURL *url = [NSURL fileURLWithPath:[[NSBundle mainBundle] pathForResource:@"final_video" ofType:@"mov"]];
   
    self.moviePlayer =  [[MPMoviePlayerController alloc]
                     initWithContentURL:url];
   
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(moviePlayBackDidFinish:)
                                                 name:MPMoviePlayerPlaybackDidFinishNotification
                                               object:_moviePlayer];
   
    self.moviePlayer.controlStyle = MPMovieControlStyleDefault;
    self.moviePlayer.shouldAutoplay = YES;
    [self.view addSubview:self.moviePlayer.view];
    [self.moviePlayer setFullscreen:YES animated:YES];
}

==> This Method And Action For Play LIve YouTube Video On Application:

- (IBAction)btnPlayLiveVideoClick:(id)sender {
   
    //=> Live Playing Url:-

    NSURL *url = [NSURL URLWithString:@"http://www.ebookfrenzy.com/ios_book/movie/movie.mov"];
   
    self.moviePlayer =  [[MPMoviePlayerController alloc]
                         initWithContentURL:url];
   
    [[NSNotificationCenter defaultCenter] addObserver:self
                                             selector:@selector(moviePlayBackDidFinish:)
                                                 name:MPMoviePlayerPlaybackDidFinishNotification
                                               object:_moviePlayer];
   
    self.moviePlayer.controlStyle = MPMovieControlStyleDefault;
    self.moviePlayer.shouldAutoplay = YES;
    [self.view addSubview:self.moviePlayer.view];
    [self.moviePlayer setFullscreen:YES animated:YES];
}

==> Here Use Some MpMoviewPlayed Controller Method And Action Of It:

#pragma mark MPMoviePlayerController methods

- (void) moviePlayBackDidFinish:(NSNotification*)notification {
    MPMoviePlayerController *player = [notification object];
    [[NSNotificationCenter defaultCenter]
     removeObserver:self
     name:MPMoviePlayerPlaybackDidFinishNotification
     object:player];
   
    if ([player
         respondsToSelector:@selector(setFullscreen:animated:)])
    {
        [player.view removeFromSuperview];
    }
}