Thursday, 25 February 2016

how to Set Edges and TableView Frame Hight IOS/Iphone

=> =================================================
  self.edgesForExtendedLayout=UIRectEdgeNone;
    self.extendedLayoutIncludesOpaqueBars=NO;
    self.automaticallyAdjustsScrollViewInsets=NO;
    self.navigationItem.backBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"" style:UIBarButtonItemStylePlain target:nil action:nil] ;


======================================================
 CGRect frame = tblvw.tableHeaderView.frame;
    frame.size.height = 1;
    UIView *headerView = [[UIView alloc] initWithFrame:frame];
    [tblvw setTableHeaderView:headerView];
======================================================

How To Local Search And Paging Scrolling Content Ios/iphone

- (void)scrollViewDidScroll:(UIScrollView *)scrollView

{
  
 [searchBarClient resignFirstResponder];
   
 

 if (!isSearching)
{
      
    CGFloat offcet=scrollView.contentOffset.y;
 
 
   
  if(offcet == 1)
  

     {
    
   
       [tblVwClientList setContentOffset:CGPointMake(0, 44) animated:YES];


     }
       

else if (scrollView.contentOffset.y >= (scrollView.contentSize.height - scrollView.frame.size.height))

{
         
  //else if (scrollView.contentOffset.y + scrollView.frame.size.height >= scrollView.contentSize.height - 70)

{
           
           
        
   if ([ApplicationData sharedInstance].isLodding)
    
    
  {
              
 [self callWebServiceGetClientPageWise];
 
        
 }
        
   else
        
   {
     

          // NSLog(@"page called");
             
  // [self callWebServicePageWise];
              
 //pageNumber=pageNumber+1;
  
 
       }
 
         
     
  }
   
    // [searchBarClient resignFirstResponder];



   }
   

}

- (void)searchLocalArrayList
{
  
 NSString *searchString = searchBar.text;


  NSPredicate *predicate = [NSPredicate predicateWithFormat:@"self.clientName contains[cd] %@",searchString];


   NSMutableArray *arrType;
  
 arrType = [[NSMutableArray alloc] initWithArray:yourMaiinArray];

   [arrType filterUsingPredicate:predicate];
   
 
  searchResultArray = arrType;

}

Wednesday, 17 February 2016

how to login Facebook Ios 9 iphone

AppDelegate.m file

    #import <FBSDKLoginKit/FBSDKLoginKit.h>
    #import <FBSDKCoreKit/FBSDKCoreKit.h>

- (BOOL)application:(UIApplication *)application
            openURL:(NSURL *)url
  sourceApplication:(NSString *)sourceApplication
         annotation:(id)annotation {
  return [[FBSDKApplicationDelegate sharedInstance]
application:application   openURL:url
   sourceApplication:sourceApplication
                      annotation:annotation];
}

- (void)applicationDidBecomeActive:(UIApplication *)application {
  [FBSDKAppEvents activateApp];
}

- (BOOL)application:(UIApplication *)application
      didFinishLaunchingWithOptions:

(NSDictionary *)launchOptions {
  return [[FBSDKApplicationDelegate sharedInstance]
application:application didFinishLaunchingWithOptions:launchOptions];



 ==>Login ViewController.m


-(IBAction)facebookLogin:(id)sender
{
  FBSDKLoginManager *login = [[FBSDKLoginManager alloc] init];

   if ([FBSDKAccessToken currentAccessToken])
   {
     NSLog(@"Token is available : %@",

[[FBSDKAccessToken currentAccessToken]tokenString]);
        [self fetchUserInfo];
    }
    else
    {
 [login logInWithReadPermissions:@[@"email"] fromViewController:

 self handler:^(FBSDKLoginManagerLoginResult *result, NSError *error)
         {
             if (error)
             {
                 NSLog(@"Login process error");
             }
             else if (result.isCancelled)
             {
                 NSLog(@"User cancelled login");
             }
             else
             {
                 NSLog(@"Login Success");

       if ([result.grantedPermissions containsObject:@"email"])
           {
          NSLog(@"result is:%@",result);
        [self fetchUserInfo];
          }
        else
           {
 [SVProgressHUD showErrorWithStatus:@"Facebook email permission error"];

           }
             }
         }];
    }
}

-(void)fetchUserInfo
{
    if ([FBSDKAccessToken currentAccessToken])
    {
        NSLog(@"Token is available : %@",

[[FBSDKAccessToken currentAccessToken]tokenString]);

        [[[FBSDKGraphRequest alloc] initWithGraphPath:

@"me" parameters:@{@"fields": @"id, name, email"}]
         startWithCompletionHandler:

^(FBSDKGraphRequestConnection *connection, id result, NSError *error) {
             if (!error)
             {
                 NSLog(@"results:%@",result);

                 NSString *email = [result objectForKey:@"email"];
                 NSString *userId = [result objectForKey:@"id"];

                 if (email.length >0 )
                 {
                     //Start you app Todo
                 }
                 else
                 {
                    NSLog(@“Facebook email is not verified");
                 }
             }
             else
             {
                 NSLog(@"Error %@",error);
            }
         }];
    }
}

Friday, 12 February 2016

Work with Crop Image in Center Ios/iphone

- (UIImage *)imageByCroppingImage:(UIImage *)image toSize:(CGSize)size
{
 // not equivalent to image.size (which depends on the imageOrientation)! 
 double refWidth = CGImageGetWidth(image.CGImage); 
 double refHeight = CGImageGetHeight(image.CGImage);

    double x = (refWidth - size.width) / 2.0;
    double y = (refHeight - size.height) / 2.0; 
 CGRect cropRect = CGRectMake(x, y, size.height, size.width); 
 CGImageRef imageRef = CGImageCreateWithImageInRect([image CGImage], 
    cropRect); 
 UIImage *cropped = [UIImage imageWithCGImage:imageRef scale:0.0 
  orientation:self.imageOrientation];
    CGImageRelease(imageRef);

    return cropped;
}

Thursday, 7 January 2016

How To Use Content Mode Of UI Controll IOS/Iphone

yourimageView.contentMode = UIViewContentModeCenter;
if ( yourimageView.bounds.size.width > yourimageView.size.width && 
yourimageView.bounds.size.height > yourimageView.size.height) {
   yourimageView.contentMode = UIViewContentModeScaleAspectFit;
}
 
 
typedef NS_ENUM(NSInteger, UIViewContentMode) {
UIViewContentModeScaleToFill,
UIViewContentModeScaleAspectFit,     
UIViewContentModeScaleAspectFill,    
UIViewContentModeRedraw,              
UIViewContentModeCenter,            
UIViewContentModeTop,
UIViewContentModeBottom,
UIViewContentModeLeft,
UIViewContentModeRight,
UIViewContentModeTopLeft,
UIViewContentModeTopRight,
UIViewContentModeBottomLeft,
UIViewContentModeBottomRight,
}; 

Monday, 4 January 2016

Get Date Time Interval From Today Ios/Iphone

// Right now, you can remove the seconds into the day if you want
NSDate *today = [NSDate date];

// All intervals taken from Google
NSDate *yesterday = [today dateByAddingTimeInterval: -86400.0];
NSDate *thisWeek  = [today dateByAddingTimeInterval: -604800.0];
NSDate *lastWeek  = [today dateByAddingTimeInterval: -1209600.0];

// To get the correct number of seconds in each month use NSCalendar
NSDate *thisMonth = [today dateByAddingTimeInterval: -2629743.83];
NSDate *lastMonth = [today dateByAddingTimeInterval: -5259487.66];

Friday, 1 January 2016

How To Get Curren Device Ios/Iphone

 UIDevice *deviceInfo = [UIDevice currentDevice];

 NSLog(@“Device name:  %@”, deviceInfo.name);