Thursday 28 June 2012

shake gesture coding

[UIView beginAnimations:@"RotationAnimation" context:nil];
               
                CABasicAnimation *fullRotationAnimation;
                fullRotationAnimation = [CABasicAnimation animationWithKeyPath:@"transform.rotation.z"];
                fullRotationAnimation .fromValue = DegreesToNumber(-0.9);
                fullRotationAnimation.toValue = DegreesToNumber(0.9);
                fullRotationAnimation.duration = 0.25;          // speed for the rotation. Smaller number is faster
                fullRotationAnimation.repeatCount = 1e100f;  // number of times to spin. 1 = once
                [fullRotationAnimation setFillMode:kCAFillModeBoth];
                [gestureView.layer addAnimation:fullRotationAnimation forKey:@"rotate"];
               
                [UIView commitAnimations];

Wednesday 27 June 2012

XMPP Chat Connection ChatConnection

//
//  ChatConnection.h
//  ChatModule
//
//  Created by Gaurav & Piyush on 27/06/12.
//  Copyright (c) 2012 __MyCompanyName__. All rights reserved.
//
// Ref: http://wiki.xmpp.org/web/Programming_XMPP_Clients
//      http://xmpp.org/xmpp-protocols/xmpp-extensions/
//      http://gauravds.blogspot.in/2012/06/nsstring-str-xmlnsjabberclient.html

#import <Foundation/Foundation.h>

#pragma mark - Chat Delegate Protocol
// a protocol
@protocol ChatDelegate <NSObject>

typedef enum ConnectionResponse{
    kConnected,
    kNotConnected
}ConnectionResponse;

Tuesday 26 June 2012

How to install Mac OS X Lion in Virtualbox [Windows]


We've already covered how to install Mac OS X Snow Leopard on a virtual machine with Virtualbox, which is great practice for installing Mac OS X on your actual computer. That guide focused on the legal method of Hackintoshing, which is to use a retail Snow Leopard installation DVD. However, there's no way to install a retail copy of Mac OS X Lion on Virtualbox, unless you already own a Mac (which is a totally unreasonable requirement). If you want to install Lion on a virtual machine in Windows, you'll have to take a different approach: distros.


get image / image url of facebook profile image using facebook ID

NSString *fbid = @"100002487000344";
NSString *imageURL = [NSString stringWithFormat:@"https://graph.facebook.com/%@/picture",fbid];

Wednesday 13 June 2012

UIImage corner with border color

CALayer * l = [imageViewRotateBg layer];
 [l setMasksToBounds:YES]; 
 [l setCornerRadius:10.0];
               
               
 // You can even add a border
 [l setBorderWidth:1.5];              
 [l setBorderColor:[[UIColor darkGrayColor] CGColor]];
imageView.image = [UIImage imageNamed:@"myImage"];

Tuesday 12 June 2012

XMPP + iphone starting

http://wiki.xmpp.org/web/Programming_XMPP_Clients  
http://xmpp.org/extensions/xep-0077.html#usecases-register 
http://xmpp.org/rfcs/rfc3920.html#streams

#import "NSStreamAdditions.h"
------------------------------------------
NSInputStream *inputStream;
    NSOutputStream *outputStream;
    CFReadStreamRef readStream ;
    CFWriteStreamRef writeStream;
------------------------------------------
- (void)viewDidLoad{
 [self connectToServerUsingStream:@"192.168.0.128"
                            portNo: 5222];
}

-(void) connectToServerUsingStream:(NSString *)urlStr
                            portNo: (uint) portNo {

Monday 11 June 2012

XMLReader : convert XML to NSDictionary

//
//  XMLReader.h
//
//

#import <Foundation/Foundation.h>

GPImage core features

GPImage => Using Category of UIImage

some util tools for UIImage

GPImageView

GPImageView : UIImageView

Used for getting the image from server (URL), cache, activity indicator, default image concept and main important point is running on main thread and using runloops
more detail visit

Friday 8 June 2012

Share Class : Email, SMS, Fb , twitter

======== Calling way  ======================= 
#import "ShareViewController.h"

ShareViewController *svc;

- (IBAction)ButtonSharePressed:(id)sender{
  
    svc = [ShareViewController new];
  
    [svc setStringMessage:@"this is a message"];
  
    [svc startShare:self];
  
}

Monday 4 June 2012

facebook post a image on wall

 NSMutableDictionary *params = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                                   userImgView.image, @"picture",
                                   nil];
   
    [[AppDelegate sharedAppDelegate].facebook requestWithGraphPath:@"me/photos"
                         andParams:params
                     andHttpMethod:@"POST"
                       andDelegate:self];

Saturday 2 June 2012

CGRect with origin selection


 enum originSelection Discription

 1 2 3
 4 5 6
 7 8 9

 1 : kOriginSelectionDefault, kOriginSelectionTopLeft


 2 : kOriginSelectionTopMid

Friday 1 June 2012

nslog with pr macro preprocessor

#define pr(str,args...) NSLog(str,args);
#define pro(str)        NSLog(@"%@",str);