Showing posts with label iPhone. Show all posts
Showing posts with label iPhone. Show all posts

Saturday, November 3, 2012

iOS Resolution


Useful info about iOS devices:

iPhone Resolution
iPhone 3GS 480-by-320-pixel resolution at 163 ppi
iPhone 4S 960-by-640-pixel resolution at 326 ppi
iPhone 5 1136-by-640-pixel resolution at 326 ppi

iPad Resolution
iPad 4 2048-by-1536 resolution at 264 pixels per inch (ppi)
iPad mini 1024-by-768 resolution at 163 pixels per inch (ppi)
iPad 2 1024-by-768 resolution at 132 pixels per inch (ppi)

Sunday, June 3, 2012

UIImage From Movie File

Simple utility method to create a image from video file. Specify the size of the image and the time interval.

UIImage *getImageFromMovieAtTime(AVURLAsset *videoAsset, CGSize imageSize,CMTime frameTime)
{
    NSError *error =nil;
    CMTime actualTime;
    
    
    AVAssetImageGenerator *imageGenerator = [AVAssetImageGenerator assetImageGeneratorWithAsset:videoAsset];
    imageGenerator.appliesPreferredTrackTransform = YES;
    imageGenerator.maximumSize = imageSize;
    CGImageRef imageRef = [imageGenerator copyCGImageAtTime:frameTime actualTime:&actualTime error:&error];
    UIImage *movImage = [UIImage imageWithCGImage:imageRef];
    CGImageRelease(imageRef);
    
    if(error || movImage == nil)
    {
         DEBUGLOG(@"Error: %@",error);
    }
    DEBUGLOG(@"imagesize: %@",NSStringFromCGSize(movImage.size));
 
 return movImage;
}
Usage:
    UIImage *videoFrame = getImageFromMovieAtTime(videoAsset, CGSizeMake(width, height),kCMTimeZero);

Monday, May 28, 2012

Launching Map App on iOS to show route between source and destination location


+(void)showRouteOnMapFrom:(CLLocationCoordinate2D)sourceCoordinate to:(CLLocationCoordinate2D) destCoordinate
{
    NSString* urlString = [NSString stringWithFormat: @"http://maps.google.com/maps?saddr=%f,%f&daddr=%f,%f",
                           sourceCoordinate.latitude, sourceCoordinate.longitude,destCoordinate.latitude, destCoordinate.longitude];
    
    [[UIApplication sharedApplication] openURL:[NSURL URLWithString:urlString]];
}