/ Published in: Objective C
Expand |
Embed | Plain Text
#import <MobileCoreServices/UTCoreTypes.h> #define SOURCETYPE UIImagePickerControllerSourceTypeCamera -(void)saveImageInBackGround{ Class aMsgClass = NSClassFromString(@"MFMessageComposeViewController"); // following will check // if user has device higher then equal to 3GS // and using iPhone os higher then iOS 4.0 (multitasking) if(aMsgClass && [UIImagePickerController isSourceTypeAvailable:SOURCETYPE]){ bool isA3GS = [mediaTypes containsObject:kUTTypeMovie]; if(isA3GS){ // NSLog(@"yep 3gs and more"); UIImageWriteToSavedPhotosAlbum(self.imgBig, nil, nil, nil); } else { // NSLog(@"nop ! Sorry compressed image will be saved."); // if it's not a 3GS or higher device. // first compress image UIImage *img=[UIImage imageWithData:UIImageJPEGRepresentation(self.smallImage, 0.59)]; // then save it to photo album. UIImageWriteToSavedPhotosAlbum(img, nil, nil, nil); // this statement will take time to execute. } } else { // NSLog(@"nop ! Sorry compressed image will be saved."); // first compress image UIImage *img=[UIImage imageWithData:UIImageJPEGRepresentation(self.smallImage, 0.59)]; // then save it to photo album. UIImageWriteToSavedPhotosAlbum(img, nil, nil, nil); // this statement will take time to execute. } }
You need to login to post a comment.
