Posts

Showing posts from 2012

PayPal SDK for iOS

PayPal SDK for iOS Another day another dollar. After spending half a day, well I should say wasting half a day I've finally figured out how to add  PayPal's   SDK  for  iOS . I'm currently using  XCode  4. I will break it down into steps so hopefully this will help others! 1.)  SDK  Download. - First you have to download the  PayPal   iOS   SDK  from  here . 2.) "Adding the Files" - Control Click on your project.xcode file and chose "Add files to project" (or chose File->"Add files to Project"). - Navigate to where you had saved your downloaded  PayPal   SDK  on disk. - You will find a folder named "Library" which contains 11 header files, as well as a static library named " libPayPalMPL .a". - Select all of these files and check the "Copy items into destination group's folder (if needed)  check box . - Now before you build your project you have to add additional libraries. 

Crop Image

Crop the image //Croping start from x=0; y=0; and till width=125 and height=128; UIImage * image = imageView . image ; CGRect cropRect = CGRectMake ( 0 , 0 , 125 , 128 ); CGImageRef imageRef = CGImageCreateWithImageInRect ([ image CGImage ], cropRect ); [ imageView setImage :[ UIImage imageWithCGImage : imageRef ]];   CGImageRelease ( imageRef ); Mask Image - ( UIImage * ) maskImage : ( UIImage * ) image withMask : ( UIImage * ) maskImage {   CGImageRef maskRef = maskImage.CGImage;   CGImageRef mask = CGImageMaskCreate ( CGImageGetWidth ( maskRef ) , CGImageGetHeight ( maskRef ) , CGImageGetBitsPerComponent ( maskRef ) , CGImageGetBitsPerPixel ( maskRef ) , CGImageGetBytesPerRow ( maskRef ) , CGImageGetDataProvider ( maskRef ) , NULL , false ) ;   CGImageRef masked = CGImageCreateWithMask ( [ image CGImage ] , mask ) ; return [ UIImage imageWithCGImage : masked ] ;   }

How to restrict user to enter character in phone UITextField

When you want user to enter only number (like in case of mobile number) then you can restrict using this 1. Put a macro before @implementation        #define NUMERIC @"1234567890" 2. textField DelegateMethod       - ( BOOL ) textField :( UITextField *) textField shouldChangeCharactersInRange :( NSRange ) range replacementString :( NSString *) string { NSCharacterSet * unacceptedInput = nil ; if ( textField == self . phoneTextField ) { unacceptedInput = [[ NSCharacterSet characterSetWithCharactersInString : NUMERIC ] invertedSet ]; } return ([[ string componentsSeparatedByCharactersInSet : unacceptedInput ] count ] <= 1 ); }

Nice tutorial

Nice One http://rypress.com/tutorials/objective-c/ TableView DragAndDrop row from one table to other http://www.scott-sherwood.com/ios-5-drag-and-drop-between-uitableviews/ Sample github TableViewCell http://code.tutsplus.com/tutorials/ios-sdk-crafting-custom-uitableview-cells--mobile-15702 Animation http://blog.devedup.com/index.php/2010/03/03/iphone-animate-an-object-along-a-path/ FlowCover -> Vertical Scrolling View http://www.chaosinmotion.com/flowcover.html Creating Static Libraries For iO S http://www.icodeblog.com/2011/04/07/creating-static-libraries-for-ios/ http://www.stanford.edu/class/cs193p/cgi-bin/drupal/downloads-2011-fall http://rypress.com/ AutoLayout http://blogs.captechconsulting.com/blog/raymond-robinson/ios-6-tutorial-series-dynamic-interfaces-auto-layout

Flip The image

This is to flip the image. UIImage * flipped = [ UIImage imageWithCGImage : imag . CGImage scale : 1.0 orientation : UIImageOrientationDown ];

The simplest way to resize an UIImage.

+ ( UIImage *) imageWithImage :( UIImage *) image scaledToSize :( CGSize ) newSize { //UIGraphicsBeginImageContext(newSize); UIGraphicsBeginImageContextWithOptions ( newSize , NO , 0.0 ); [ image drawInRect : CGRectMake ( 0 , 0 , newSize . width , newSize . height )]; UIImage * newImage = UIGraphicsGetImageFromCurrentImageContext (); UIGraphicsEndImageContext (); return newImage ; } StackOveFlow  Link

Show hidden files Mac OS X 10.7 Lion and 10.8 Mountain Lion

To Show hidden files/folders in finder windows: Open Finder. Open the Utilities folder. Open a terminal window. Copy and paste the following line in terminal: >> defaults write com.apple.finder AppleShowAllFiles TRUE >> killall Finder Line 1:  command will show all hidden files and folder. Line 2:    command is to re-launch the Finder window. You should find you will now be able to see any hidden files or folders. Revert Back :: One you are done, perform the steps above however, replace the terminal command in step 4 with: >> defaults write com.apple.finder AppleShowAllFiles FALSE >> killall Finder

quick App Publishing on iTunes. No MAC required!

Bypass iTunes Sync Process with App Loader for quick App Publishing on iTunes. No MAC required! Bypass iTunes Sync Process with App Loader for quick App Publishing on iTunes. No MAC required! iBuildApp today launched App Loader, a service that makes it easy to publish iPhone app on iTunes without using MAC. The service is perfect for people without coding experience by enabling quick iPhone app Publishing. The following have been released today: 1 . Improved color picker tool (to chose the color for background) 2.  Automated App Loader (to allow clients who don’t have a MAC or don’t know how to generate a CSR, generate it using our platform) 3.  Now iBuildapp provides service for uploading app binary on the app store: we recieve requests for uploading app binaries on iTunes Connect and charge $30 4.  Android native apps – work the same way as iPhone native apps. Now you can create the same app for both platforms: iOS and Android The following features have been included

Predicates

A predicate is a useful object that filters an array. It’s a bit like having a select with a simple where clause in SQL. If you have array in this format NSMutableArray * yourAry ; (         {         category = classic ;         quote = "Frankly, my dear, I don't give a damn." ;         source = "Gone With the Wind" ;     },         {         category = classic ;         quote = "Here's looking at you, kid." ;         source = Casablanca ;     } {         category = modern ;         quote = "I solemnly swear that I am up to no good." ;         source = "Harry Potter and the Prisoner of Azkaban" ;     },         {         category = modern ;         quote = "You like pain? Try wearing a corset." ;         source = "Pirates of the Caribbean" ;     } ) And you want to search all the array which category = classic then we can use  NSPredicate . NSStrin

OS X Lion Is Hiding Your Library Folder

Make the Library Visible Permanently Apple hides the Library folder by setting a file system flag associated with the folder. Any folder on your Mac can have its visibility flag turned on or off; Apple just chose to set the Library folder's visibility flag to the off state. To reset the visibility flag, do the following: Launch Terminal, located at /Applications/Utilities. Enter the following command at the Terminal prompt: chflags nohidden ~/Library Once the command is executed, you can quit Terminal. The Library folder will now be visible in the Finder. Should you ever wish to set the Library folder back to its default hidden state in OS X Lion, simply launch Terminal and issue the following Terminal command: chflags hidden ~/Library Unhide the Library Folder, the Apple Way With either the desktop or a Finder window as the front most application, hold down the option key and select the Go menu. The Library folder will be listed as one of the items in t

ANIMATIONS

1 -> [ viewContent . layer addAnimation :[ self getShakeAnimation ] forKey :@ "transform.scale" ]; - ( CAAnimation *) getShakeAnimation {     CAKeyframeAnimation * animation = [ CAKeyframeAnimation animation ];     animation . values = [ NSArray arrayWithObjects :                         [ NSValue valueWithCATransform3D : CATransform3DMakeRotation ( M_PI_2 , 0.0f , 1.0f , 0.0f )],                         [ NSValue valueWithCATransform3D : CATransform3DMakeRotation ( M_PI , 0.0f , 0.0f , 0.0f )],                         [ NSValue valueWithCATransform3D : CATransform3DMakeRotation ( M_PI * 2 , 0.0f , 1.0f , 0.0f )], nil ];  animation . duration = 0.8f ;  animation . delegate = self ;     return animation ; }   2 ->  animate view from bottom to top -( void )makeAnimation {     CGRect optionsFrame = { 0 , 480 , 320 , 480 };     userNameEmailView.frame = optionsFrame;     [ UIView beginAnimations:nil context:nil];     [ UI