Bordertown Labs Blog

Notes from Bordertown Labs with posts regarding software development for the iPhone, Ruby on Rails, tips and code.

» Contact with inquiries.


Visualize your geodata in augmented reality with 3DAR by Spot Metrix.


Posts tagged "code"

Oct 3rd, 2011 @ 2:12 am

(via How to Check-In Using the Facebook iOS SDK and Graph API | Tyler White Design)

(via How to Check-In Using the Facebook iOS SDK and Graph API | Tyler White Design)




Comments (View)

 


 

Sep 20th, 2011 @ 5:38 pm

Using GCD and Blocks Effectively


dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_LOW, 0), ^{
    NSURL *url = [NSURL URLWithString:@"http://bit.ly/nUX01h"];
    NSURLRequest *req = [NSURLRequest requestWithURL:url];
    [NSURLConnection sendAsynchronousRequest:req
                                       queue:[NSOperationQueue currentQueue]
                           completionHandler:
     ^(NSURLResponse *res, NSData *data, NSError *err) {
         // Convert the data to a UIImage
         UIImage *image = [UIImage imageWithData:data];
           
         // Scale the image
         UIImage *thumbImage = nil;
         CGSize newSize = CGSizeMake(90, (90 / image.size.width) * image.size.height);
         UIGraphicsBeginImageContext(newSize);
         [image drawInRect:CGRectMake(0, 0, newSize.width, newSize.height)];
         thumbImage = UIGraphicsGetImageFromCurrentImageContext();
         UIGraphicsEndImageContext();
           
         dispatch_async(dispatch_get_main_queue(), ^{
             self.imageView.image = thumbImage;
         });
     }];
});




Comments (View)

 


 

Mar 2nd, 2011 @ 1:43 pm

Apple camera iris animation

The iPhone Development Wiki has a very nice listing of private animations which are available but not necessarily acceptable by Apple. Here’s how to show the coveted iris animation.

CATransition *animation = [CATransition animation];
animation.delegate = self;
animation.duration = 0.33;
animation.timingFunction = UIViewAnimationCurveEaseInOut;
animation.type = @"cameraIrisHollowOpen";  // Or cameraIrisHollowClose, cameraIris

[someContainerView.layer addAnimation:animation forKey:nil];

I recommend setting the duration to INT_MAX and taking a screenshot of the closed iris and then throwing that into a UIImageView to display before the animation begins, then hide the image right after starting the animation.




Comments (View)

 


 

Dec 8th, 2010 @ 12:00 pm

Nick Farina - Simplify your models with SMModelObject

For almost every app we’ve made, I find myself writing “model classes” to store structured data and logic.

This all started when André Pang wrote an amazing model base class called RMModelObject a few years back that is incredibly sophisticated and provides these same great features on the legacy ObjC runtime. RMModelObject was the inspiration for my class, which was much easier to write since ObjC 2.0 does all the heavy lifting.




Comments (View)

 


 

Aug 1st, 2010 @ 12:02 pm

WWDC 2010 Sample Code

The sample code provided in this package reflects the state of the code as of WWDC 2010. For the most up to date sample code see the Reference Libraries at http://developer.apple.com.

See http://developer.apple.com/videos/wwdc/2010/ for slides and videos.




Comments (View)

 


 

Jul 2nd, 2010 @ 2:51 pm

Developer Forums: MPMoviePlayer seems to play the audio but no video.

The MPMoviePlayerController was changed (since OS 3.2). It now contains a ‘view’ property that you must add to your view hierarchy, don’t forget to set the frame size as well. EDIT: Sorry, that was a bit premature. Here’s how I play movies on the iPhone now.

if ([UIViewController instancesRespondToSelector:@selector(presentMoviePlayerViewControllerAnimated:)]) 
{
    // >= SDK 3.2
    MPMoviePlayerViewController *movieVC = // init
    ...
    [someController presentMoviePlayerViewControllerAnimated:movieVC];
}
else
{
    // pre SDK 3.2
    MPMoviePlayerController *moviePlayer = // init
    ...
    [moviePlayer play];
}




Comments (View)

 


 

May 26th, 2010 @ 1:59 pm

Making an eyedropper




Comments (View)

 


 

Feb 5th, 2010 @ 12:53 pm

ASIHTTPRequest Amazon S3

Asynchronous calls to S3 from the iPhone. Nice.




Comments (View)

 


 

Jan 27th, 2010 @ 5:08 am

Objective-C class for zip/unzip

This works great on the iPhone.

ZipArchive* za = [[ZipArchive alloc] init];
if ([za UnzipOpenFile:@"/Volumes/data/testfolder/Archive.zip"]) {

  BOOL ret = [za UnzipFileTo:@"/Volumes/data/testfolder/extract" overWrite:YES];

  if (NO == ret) {
  }
  
  [za UnzipCloseFile];
}

[za release];
  




Comments (View)

 


 

Jan 19th, 2010 @ 9:31 am

jQuery Swipe plugin

For iPhone swipe gestures.




Comments (View)

 


 

Archive · RSS · Theme by Autumn