List of all Iphone and Blackberry Development codes in a one click Iphone,objective C,xcode,blackberry Development,iOS Development

Friday, May 12, 2017

iOS Singleton Class


To set values, use the below code.

YourSingletonClass *sharedManager = [YourtSingletonClass sharedManager];
sharedManager.nameString =@"name";
sharedManager.emailString =@"name@domain.com";

For getting values, use the below code
YourSingletonClass *sharedManager = [YourtSingletonClass sharedManager];
NSString *nameVal=sharedManager.nameString;
NSString *emailVal=sharedManager.emailString;


/////YourSingletonClass.h class

#import

@interface YourSingletonClass : NSObject{
    NSString *nameString;
    NSString *emailString;
}

@property (nonatomic, strong) NSString *nameString;
@property (nonatomic, strong) NSString *emailString;
+ (id)sharedManager;
@end

/////YourSingletonClass.m class

#import "YourSingletonClass.h"
@implementation YourSingletonClass
@synthesize nameString;
@synthesize emailString;

+ (id)sharedManager {
    static YourSingletonClass *sharedMyManager = nil;
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        sharedMyManager = [[self alloc] init];
    });
    return sharedMyManager;
}

- (id)init {
    if (self = [super init]) {
        self.nameString = @"";
        self.emailString = @"";
    }
    return self;
}

- (void)dealloc {
    // Should never be called, but just here for clarity really.
}
@end



Friday, May 5, 2017

ios PayFort Payment Gateway Integration

Reference https://docs.payfort.com/
NSMutableData *webDataglobal;
NSString *sdk_token;
PayFortController *payFort;
Add PayFortDelegate in .h file.

payFort = [[PayFortController  alloc]initWithEnviroment:KPayFortEnviromentSandBox];
payFort.delegate = self;
payFort.IsShowResponsePage = YES;
             
NSMutableString *post = [NSMutableString string];
[post appendFormat:@"TESTSHAINaccess_code=%@", @"accesscodeFromAdminPortal"];
[post appendFormat:@"device_id=%@",  [payFort getUDID]];
[post appendFormat:@"language=%@", @"en"];
[post appendFormat:@"merchant_identifier=%@", @"merchantIdentifierFromAdminPortal"];
post appendFormat:@"service_command=%@", @"SDK_TOKENTESTSHAIN"];
NSDictionary *tmp = [[NSDictionary alloc] initWithObjectsAndKeys:
                                           @"SDK_TOKEN", @"service_command",
                                           @"merchantIdentifierFromAdminPortal", @"merchant_identifier",
                                           @"accesscodeFromAdminPortal", @"access_code",                                           [self sha1Encode:post],@"signature",
                                           @"en", @"language",
                                           [payFort getUDID], @"device_id",
                                           nil];
             
NSError *error;
NSData *postdata = [NSJSONSerialization dataWithJSONObject:tmp options:0 error:&error];
NSString *BaseDomain =@"https://sbpaymentservices.payfort.com/FortAPI/paymentApi";
NSString *urlString = [NSString stringWithFormat:@"%@",BaseDomain];
//NSData *postData = [post dataUsingEncoding:NSASCIIStringEncoding allowLossyConversion:YES];
NSString *postLength = [NSString stringWithFormat:@"%ld",[postdata length]];
NSMutableURLRequest *request = [[NSMutableURLRequest alloc] init];
[request setURL:[NSURL URLWithString:urlString]];
[request setHTTPMethod:@"POST"];
[request setValue:postLength forHTTPHeaderField:@"Content-Length"];
[request setValue:@"application/json" forHTTPHeaderField:@"Accept"];
[request setValue:@"application/json" forHTTPHeaderField:@"Content-Type"];
//[request setValue:@"application/x-www-form-urlencoded" forHTTPHeaderField:@"Content-Type"];
[request setHTTPBody:postdata];
//NSLog(@"signal mname %@", signalNameFunction);
NSLog(@"url string %@",urlString);
NSLog(@"url post %@",tmp);
// NSURLConnection *connection = [[NSURLConnection alloc] initWithRequest:request  delegate:self];
NSURLConnection *connection = [NSURLConnection connectionWithRequest:request delegate:self];
if(connection){
  webDataglobal = [NSMutableData data];
 }
else{
  NSLog(@"The Connection is null");
}




-(void)connection:(NSURLConnection *)connection didReceiveResponse:(NSURLResponse *)response{
    [webDataglobal setLength: 0];
}

-(void)connection:(NSURLConnection *)connection didReceiveData:(NSData *)data{
    [webDataglobal appendData:data];
}

-(void)connection:(NSURLConnection *)connection didFailWithError:(NSError *)error{
    NSLog(@"error %@",error);
      payFort.IsShowResponsePage = NO;
}

-(void)connectionDidFinishLoading:(NSURLConnection *)connection{
    
    id collection = [NSJSONSerialization JSONObjectWithData:webDataglobal options:0 error:nil];
    NSLog(@"receive data %@",collection);
    sdk_token = collection[@"sdk_token"];
    [self launch];
    
}

- (NSString*)sha1Encode:(NSString*)input {
    const char *cstr = [input cStringUsingEncoding:NSUTF8StringEncoding];
    NSData *data = [NSData dataWithBytes:cstr length:input.length];
    
    uint8_t digest[CC_SHA256_DIGEST_LENGTH];
    
    CC_SHA256(data.bytes, (int)data.length, digest);
    
    NSMutableString* output = [NSMutableString stringWithCapacity:CC_SHA256_DIGEST_LENGTH * 2];
    
    for(int i = 0; i < CC_SHA256_DIGEST_LENGTH; i++)
        [output appendFormat:@"%02x", digest[i]];
    
    return output;
}

-(void) launch{
    //[NSString stringWithFormat:@"%d", [self.cartResponse.amount_payable intValue]]
    NSMutableDictionary *request = [[NSMutableDictionary alloc]init];
    [request setValue:[NSString stringWithFormat:@"%d", [self.cartResponse.amount_payable intValue]*100] forKey:@"amount"];
    [request setValue:@"PURCHASE" forKey:@"command"];
    [request setValue:@"QAR" forKey:@"currency"];
    [request setValue:@"customerEmail" forKey:@"customer_email"];
    [request setValue:@"en" forKey:@"language"];
    [request setValue:[NSString stringWithFormat:@"%lld", [@(floor([[NSDate date] timeIntervalSince1970] * 1000)) longLongValue]] forKey:@"merchant_reference"];
    [request setValue:sdk_token forKey:@"sdk_token"];
    [payFort setPayFortRequest:request]; // Must Send [payFort callPayFort:self]
    
    payFort.IsShowResponsePage = YES;
    [payFort callPayFort:self];
}

- (void)sdkResult:(id)response{
    NSLog(@"Result--------%@",response);
    if([[response objectForKey:@"status"] intValue ]==14 ){
     //success
    }else{
    //fail
    }
}

ios In App Purchase

SKProductsRequest *productsRequest = [[SKProductsRequest alloc] initWithProductIdentifiers:[NSSet setWithObject:@"IAP_plan_id"]];
        productsRequest.delegate = self;

        [productsRequest start];


- (void)productsRequest:(SKProductsRequest *)request didReceiveResponse:(SKProductsResponse *)response{
    SKProduct *validProduct = nil;
    int count = [response.products count];
    if(count > 0){
        validProduct = [response.products objectAtIndex:0];
        NSLog(@"Products Available!");
        [self purchase:validProduct];
    }
    else if(!validProduct){
        NSLog(@"No products available");
        UIAlertView *alert = [[UIAlertView alloc] initWithTitle:@"" message:@"Product not available" delegate:nil cancelButtonTitle:nil otherButtonTitles:@"OK", nil];
        [alert show];
        //this is called if your product id is not valid, this shouldn't be called unless that happens.
    }
}

- (void)purchase:(SKProduct *)product{
     SKPayment *payment = [SKPayment paymentWithProduct:product];
    [[SKPaymentQueue defaultQueue] addTransactionObserver:self];
    [[SKPaymentQueue defaultQueue] addPayment:payment];
}

- (void)paymentQueue:(SKPaymentQueue *)queue updatedTransactions:(NSArray *)transactions{
    for(SKPaymentTransaction *transaction in transactions){
        switch(transaction.transactionState){
            case SKPaymentTransactionStatePurchasing:
                NSLog(@"Transaction state -> Purchasing");
               
                //called when the user is in the process of purchasing, do not add any of your own code here.
                break;
            case SKPaymentTransactionStatePurchased:
             
                [[SKPaymentQueue defaultQueue] finishTransaction:transaction];
               // NSString *receiptStr= [Base64Encoding base64EncodingForData:(transaction.transactionReceipt) WithLineLength:0];
               //Purchase success
                break;
            case SKPaymentTransactionStateRestored:
                NSLog(@"Transaction state -> Restored");
                [[SKPaymentQueue defaultQueue] finishTransaction:transaction];
                break;
            case SKPaymentTransactionStateFailed:
                //called when the transaction does not finish
                if(transaction.error.code == SKErrorPaymentCancelled){
                    NSLog(@"Transaction state -> Cancelled");
                }
                [[SKPaymentQueue defaultQueue] finishTransaction:transaction];
                break;
        }
    }
}


//will get all the purchased plans//////
-(void)validateReceiptForTransaction
{
    /* Load the receipt from the app bundle. */
    
    NSURL *receiptURL = [[NSBundle mainBundle] appStoreReceiptURL];
    NSData *receipt = [NSData dataWithContentsOfURL:receiptURL];
    
    if (!receipt) {
        /* No local receipt -- handle the error. */
    }
    
    /* ... Send the receipt data to your server ... */
    
    //NSData *receipt; // Sent to the server by the device
    
    /* Create the JSON object that describes the request */
    
    NSError *error;
    
    NSDictionary *requestContents = @{
                                      @"receipt-data": [receipt base64EncodedStringWithOptions:0]
                                      };
    
    NSData *requestData = [NSJSONSerialization dataWithJSONObject:requestContents
                                                          options:0
                                                            error:&error];
    
    if (!requestData) {
        /* ... Handle error ... */
    }
    
    // Create a POST request with the receipt data.
    
    NSURL *storeURL = [NSURL URLWithString:@"https://sandbox.itunes.apple.com/verifyReceipt"];
    
    NSMutableURLRequest *storeRequest = [NSMutableURLRequest requestWithURL:storeURL];
    [storeRequest setHTTPMethod:@"POST"];
    [storeRequest setHTTPBody:requestData];
    
    /* Make a connection to the iTunes Store on a background queue. */
    
    NSOperationQueue *queue = [[NSOperationQueue alloc] init];
    
    [NSURLConnection sendAsynchronousRequest:storeRequest queue:queue
                           completionHandler:^(NSURLResponse *response, NSData *data, NSError *connectionError) {
                               
                               if (connectionError) {
                                   
                                   /* ... Handle error ... */
                                   
                               } else {
                                   
                                   NSError *error;
                                   NSDictionary *jsonResponse = [NSJSONSerialization JSONObjectWithData:data options:0 error:&error];
                                   
                                   if (!jsonResponse) {
                                       /* ... Handle error ...*/
                                   }
                                   
                                   /* ... Send a response back to the device ... */
                               }
                           }];

}

Thursday, April 20, 2017

Utility class for Custom Items in ios

#import Foundation/Foundation.h
#import UIKit/UIKit.h

@interface Util : NSObject
{
    NSString *selectView;
    BOOL isPrepaidCardFlag;
}
-(UILabel *)createLabel:(NSString *)placeholder  x:(float)x y:(float)y l_Width:(float)l_Width l_Height:(float)l_Height l_Color:(UIColor *)l_Color l_Font:(UIFont *)l_Font l_NSTextAlignment:(int)l_NSTextAlignment;
-(UITextField *) createField:(NSString *)placeholder tag:(int)tag x:(float)x y:(float)y t_Width:(float)t_Width t_Height:(float)t_Height t_Color:(UIColor *)t_Color t_Font:(UIFont *)t_Font t_NSTextAlignment:(int)t_NSTextAlignment;
-(void)alertViewShow : (NSString *)_msg withTag:(int)_tag;
- (void)showPopupWithTitle:(NSString *)title
                    mesage:(NSString *)message
              dismissAfter:(NSTimeInterval)interval className:(NSString *)className;
-(NSString *) randomString;
-(CALayer *) borderLine:(float)width height:(float)height;
-(UIView *) buttonLine:(float)x y:(float)y width:(float)width height:(float)height;
- (void)showPopupWithTitleDismis:(NSString *)title
                          mesage:(NSString *)message
                    dismissAfter:(NSTimeInterval)interval className:(NSString *)className;
-(UITextField *) padding:(UITextField *)placeholder t_Height:(float)t_Height;

-(UITextField *) createFieldLightGray:(NSString *)placeholder tag:(int)tag x:(float)x y:(float)y t_Width:(float)t_Width t_Height:(float)t_Height t_Color:(UIColor *)t_Color t_Font:(UIFont *)t_Font t_NSTextAlignment:(int)t_NSTextAlignment;
-(UITextField *) createField2:(NSString *)placeholder tag:(int)tag x:(float)x y:(float)y t_Width:(float)t_Width t_Height:(float)t_Height t_Color:(UIColor *)t_Color t_Font:(UIFont *)t_Font t_NSTextAlignment:(int)t_NSTextAlignment;
@end











#import "Util.h"
#import "UIColor+customColor.h"
#import "Constants.h"
@implementation Util

-(UILabel *)createLabel:(NSString *)placeholder  x:(float)x y:(float)y l_Width:(float)l_Width l_Height:(float)l_Height l_Color:(UIColor *)l_Color l_Font:(UIFont *)l_Font l_NSTextAlignment:(int)l_NSTextAlignment{
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(x, y, l_Width, l_Height)];
    [label setText:placeholder];
    [label setTextColor:l_Color];
    [label setTextAlignment:l_NSTextAlignment];
    [label setFont:l_Font];
    label.backgroundColor = [UIColor clearColor];
    return label;
}

-(UITextField *) createField:(NSString *)placeholder tag:(int)tag x:(float)x y:(float)y t_Width:(float)t_Width t_Height:(float)t_Height t_Color:(UIColor *)t_Color t_Font:(UIFont *)t_Font t_NSTextAlignment:(int)t_NSTextAlignment
{
    UITextField *field = [[UITextField alloc] initWithFrame:CGRectMake(x, y, t_Width, t_Height)];
    field.textAlignment = t_NSTextAlignment;
    field.font = [UIFont systemFontOfSize:18];
    field.clearButtonMode = UITextFieldViewModeWhileEditing;
    //field.backgroundColor = [UIColor whiteColor];
    field.tag = tag;
    UIColor *color = [UIColor colorWithHexString:STRING_GreenWholesaleColor];
    field.attributedPlaceholder = [[NSAttributedString alloc] initWithString:placeholder attributes:@{NSForegroundColorAttributeName: color}];
    [field setKeyboardType:UIKeyboardTypeDefault];
    field.textColor = [UIColor colorWithHexString:STRING_GreenDarkColor];

    CALayer *border = [CALayer layer];
    CGFloat borderWidth = 2;
    border.borderColor = [UIColor colorWithHexString:STRING_GreenDarkColor].CGColor;
    border.frame = CGRectMake(0, field.frame.size.height - borderWidth, field.frame.size.width, field.frame.size.height);
    border.borderWidth = borderWidth;
    [field.layer addSublayer:border];
    field.layer.masksToBounds = YES;

    return field;
}

-(UITextField *) createField2:(NSString *)placeholder tag:(int)tag x:(float)x y:(float)y t_Width:(float)t_Width t_Height:(float)t_Height t_Color:(UIColor *)t_Color t_Font:(UIFont *)t_Font t_NSTextAlignment:(int)t_NSTextAlignment
{
    UITextField *field = [[UITextField alloc] initWithFrame:CGRectMake(x, y, t_Width, t_Height)];
    field.textAlignment = t_NSTextAlignment;
    field.font = [UIFont systemFontOfSize:18];
    field.clearButtonMode = UITextFieldViewModeWhileEditing;
    //field.backgroundColor = [UIColor whiteColor];
    field.tag = tag;
    UIColor *color = [UIColor colorWithHexString:STRING_GreenWholesaleColor];
    field.attributedPlaceholder = [[NSAttributedString alloc] initWithString:placeholder attributes:@{NSForegroundColorAttributeName: color, NSFontAttributeName: [UIFont systemFontOfSize:13]}];
    [field setKeyboardType:UIKeyboardTypeDefault];
    field.textColor = [UIColor colorWithHexString:STRING_GreenDarkColor];
   
    CALayer *border = [CALayer layer];
    CGFloat borderWidth = 2;
    border.borderColor = [UIColor colorWithHexString:STRING_GreenDarkColor].CGColor;
    border.frame = CGRectMake(0, field.frame.size.height - borderWidth, field.frame.size.width, field.frame.size.height);
    border.borderWidth = borderWidth;
    [field.layer addSublayer:border];
    field.layer.masksToBounds = YES;
   
    return field;
}


-(UITextField *) createFieldLightGray:(NSString *)placeholder tag:(int)tag x:(float)x y:(float)y t_Width:(float)t_Width t_Height:(float)t_Height t_Color:(UIColor *)t_Color t_Font:(UIFont *)t_Font t_NSTextAlignment:(int)t_NSTextAlignment
{
    UITextField *field = [[UITextField alloc] initWithFrame:CGRectMake(x, y, t_Width, t_Height)];
    field.textAlignment = t_NSTextAlignment;
    field.font = [UIFont systemFontOfSize:18];
    field.clearButtonMode = UITextFieldViewModeWhileEditing;
    //field.backgroundColor = [UIColor whiteColor];
    field.tag = tag;
    UIColor *color = [UIColor lightGrayColor];
    field.attributedPlaceholder = [[NSAttributedString alloc] initWithString:placeholder attributes:@{NSForegroundColorAttributeName: color}];
    [field setKeyboardType:UIKeyboardTypeDefault];
    field.textColor = [UIColor blackColor];
   
    CALayer *border = [CALayer layer];
    CGFloat borderWidth = 2;
    border.borderColor = [UIColor lightGrayColor].CGColor;
    border.frame = CGRectMake(0, field.frame.size.height - borderWidth, field.frame.size.width, field.frame.size.height);
    border.borderWidth = borderWidth;
    [field.layer addSublayer:border];
    field.layer.masksToBounds = YES;
   
    return field;
}
-(UILabel *)createLabel1:(NSString *)placeholder  x:(float)x y:(float)y l_Width:(float)l_Width l_Height:(float)l_Height l_Color:(UIColor *)l_Color l_Font:(UIFont *)l_Font l_NSTextAlignment:(int)l_NSTextAlignment{
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(x, y, l_Width, l_Height)];
    [label setText:placeholder];
    [label setTextColor:l_Color];
    [label setTextAlignment:l_NSTextAlignment];
    [label setFont:l_Font];
    label.backgroundColor = [UIColor clearColor];
    return label;
}
-(UITextField *) padding:(UITextField *)placeholder t_Height:(float)t_Height{
    UIView *paddingView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, 10, t_Height)];
    placeholder.leftView = paddingView;
    placeholder.leftViewMode = UITextFieldViewModeAlways;
    return placeholder;
}
-(void)alertViewShow : (NSString *)_msg withTag:(int)_tag {
//    UIAlertController * alert=   [UIAlertController
//                                  alertControllerWithTitle:STRING_AppName
//                                  message:_msg
//                                  preferredStyle:UIAlertControllerStyleAlert];
//    UIAlertAction *okAction = [UIAlertAction actionWithTitle:@"OK" style:UIAlertActionStyleDefault handler:^(UIAlertAction *action){
//     }];
//    [alert addAction:okAction];
//    UIViewController *vc = [[[[UIApplication sharedApplication] delegate] window] rootViewController];
//    [vc presentViewController:alert animated:YES completion:nil];
   
                UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:STRING_AppName
                                                                    message:_msg
                                                                   delegate:self
                                                          cancelButtonTitle:@"Ok"
                                                          otherButtonTitles:nil, nil];
   
                [alertView show];
   
   
}

-(NSString *) randomString {
    NSMutableString *randomString = [NSMutableString stringWithCapacity: 10];
    for (int i=0; i<10 br="" i="">        [randomString appendFormat: @"%C", [@"0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZ" characterAtIndex: arc4random_uniform(36)]];
    }
    return randomString;
}


@end






UIButton and UITextField in ios

UIButton *button = [UIButton buttonWithType:UIButtonTypeCustom];
[button addTarget:self 
           action:@selector(aMethod:)
 forControlEvents:UIControlEventTouchUpInside];
[button setTitle:@"Button" forState:UIControlStateNormal];
button.frame = CGRectMake(80.0, 210.0, 160.0, 40.0);
[view addSubview:button];
 
UITextField *textField = [[UITextField alloc] initWithFrame:CGRectMake(10, 200, 300, 40)];
textField.borderStyle = UITextBorderStyleRoundedRect;
textField.font = [UIFont systemFontOfSize:15];
textField.placeholder = @"enter text";
textField.autocorrectionType = UITextAutocorrectionTypeNo;
textField.keyboardType = UIKeyboardTypeDefault;
textField.returnKeyType = UIReturnKeyDone;
textField.clearButtonMode = UITextFieldViewModeWhileEditing;
textField.contentVerticalAlignment = UIControlContentVerticalAlignmentCenter;    
textField.delegate = self;
[self.view addSubview:textField];
[textField release]; 

PickerView in ios

_pickerData = @[@"Item 1", @"Item 2", @"Item 3", @"Item 4", @"Item 5", @"Item 6"];

  picker=[[UIPickerView alloc]initWithFrame:CGRectMake(0, 200, self.view.frame.size.width, 200)];
    picker.dataSource = self;
    picker.delegate = self;
    [self.view addSubview:picker];

// The number of columns of data
- (NSInteger)numberOfComponentsInPickerView:(UIPickerView *)pickerView
{
    return 1;
}

// The number of rows of data
- (NSInteger)pickerView:(UIPickerView *)pickerView numberOfRowsInComponent:(NSInteger)component
{
    return _pickerData.count;
}

// The data to return for the row and component (column) that's being passed in
- (NSString*)pickerView:(UIPickerView *)pickerView titleForRow:(NSInteger)row forComponent:(NSInteger)component
{
    return _pickerData[row];
}

- (void)pickerView:(UIPickerView *)pickerView didSelectRow:(NSInteger)row inComponent:(NSInteger)component
{
  //  [picker removeFromSuperview];


//array object at index row will get the selected value from array
}

CoreData in ios

#import "AppDelegate.h"

Allocation -
- (NSManagedObjectContext *)managedObjectContext {
    NSManagedObjectContext *context = nil;
    id delegate = [[UIApplication sharedApplication] delegate];
    if ([delegate performSelector:@selector(managedObjectContext)]) {
        context = [delegate managedObjectContext];
    }
    return context;
}


Adding Data -
 NSManagedObjectContext *context = [self managedObjectContext];
   
    // Create a new managed object
    NSManagedObject *newDevice = [NSEntityDescription insertNewObjectForEntityForName:@"Device" inManagedObjectContext:context];
    [newDevice setValue:@"1" forKey:@"id"];
    [newDevice setValue:@"Rince" forKey:@"name"];
   
   
    NSError *error = nil;
    // Save the object to persistent store
    if (![context save:&error]) {
        NSLog(@"Can't Save! %@ %@", error, [error localizedDescription]);
    }

Display Data -
NSManagedObjectContext *managedObjectContext = [self managedObjectContext];
    NSFetchRequest *fetchRequest = [[NSFetchRequest alloc] initWithEntityName:@"Device"];
    self.devices = [[managedObjectContext executeFetchRequest:fetchRequest error:nil] mutableCopy];
NSManagedObject *device = [self.devices objectAtIndex:indexPath.row];
    [cell.textLabel setText:[NSString stringWithFormat:@"%@ %@",[device valueForKey:@"id"], [device valueForKey:@"name"]]];

Thursday, March 16, 2017

ios sdwebimage

display image from url using sdwebimage. download

#import "UIImageView+WebCache.h"

 UIImageView *imgView=[[UIImageView alloc] initWithFrame:CGRectMake(10, 25, 80, 80)];
    imgView.backgroundColor=[UIColor clearColor];
     [imgView sd_setImageWithURL:[NSURL URLWithString:[NSString stringWithFormat:@"%@%@",IMAGE_URL,imageUrl]] placeholderImage:[UIImage imageNamed:[NSString stringWithFormat:@"images.png"]]];
    imgView.contentMode = UIViewContentModeScaleAspectFit;
    [self.view addSubview:imgView];

ios Webservice class

class for handling webservices download

[[Services sharedInstance]login:usernameTextField.text password:passwordTextField.text andListener:self];


#pragma mark- Service call back method
-(void)ServicesResult:(NSString *)success withResult:(NSDictionary *)result statusCode:(NSString *)statusCode{
  
    if([statusCode isEqualToString:@"200"]){
    
    }
    else if([statusCode isEqualToString:@"1"]){
       
        [util alertViewShow:STRING_No_Network_ERROR withTag:0];
       
    }else{
       
    }
   
}