UIImagePickerController add text to image - ios

I'm trying to capture an image or video using the camera in iOS and add some text to a black bar overlayed at the bottom of the image.
I'm trying to get the text from a user input and save the image with the text and rectangle at the bottom of the image:
How would I go about this?
I currently have this:
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType];
if ([mediaType isEqualToString:(NSString *)kUTTypeImage]) {
// A photo was taken/selected!
self.image = [info objectForKey:UIImagePickerControllerOriginalImage];
if (self.imagePicker.sourceType == UIImagePickerControllerSourceTypeCamera) {
// Save the image!
UIImageWriteToSavedPhotosAlbum(self.image, nil, nil, nil);
}
}
else {
// A video was taken/selected!
self.videoFilePath = (__bridge NSString *)([[info objectForKey:UIImagePickerControllerMediaURL] path]);
if (self.imagePicker.sourceType == UIImagePickerControllerSourceTypeCamera) {
// Save the video!
if (UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(self.videoFilePath)) {
UISaveVideoAtPathToSavedPhotosAlbum(self.videoFilePath, nil, nil, nil);
}
}
}
[self dismissViewControllerAnimated:YES completion:nil]; }
What would be the best way of going about this?

You can add a UIView over the UIImageView with black (with alpha to be 0.5) background and on this UIView you can add a UILabel with your text.

I'd say have the user do an input using a UIAlertView
here's a sample
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle:#"Title Here"
message:#"message"
delegate:self
cancelButtonTitle:#"Cancel" // or nil
otherButtonTitles:#"Ok",
nil];
alert.alertViewStyle = UIAlertViewStylePlainTextInput;
[alert show];
that shows that an alert will appear with a text box in it. Since we set self to delegate, you have to call that delegate as such
- (void)alertView:(UIAlertView *)alertView clickedButtonAtIndex:(NSInteger)buttonIndex
{
NSString *title = [alertView buttonTitleAtIndex:buttonIndex];
if ([title isEqualToString:#"Ok"]) {
NSString *alertText = [alertView textFieldAtIndex:0].text;
// create UILabel here and set the text as advised in answer above
// example with global UILabel *overlayLabel;
self.overlayLabel.text = alertText;
// self.overlayLabel.font = [UIFont ...];
}
}
This is essentially what apple does. Go to the music app, and hit the "new playlist" and you'll see it in action
hope this helps!

Related

Share a picture in chat, base64 issue

I am developing a chat, in chat I need to share pictures, my app has a button to select an image from gallery.
This is my button code:
[upBtn2 addTarget:self action:#selector(uploadImage:) forControlEvents:UIControlEventTouchUpInside];
In gallery the user can select an image to share in chat with someone else, the conversation is just 1 to 1 chat.
This is my code.
- (IBAction)uploadImage:(id)sender
{
if ([UIImagePickerController isSourceTypeAvailable:
UIImagePickerControllerSourceTypeSavedPhotosAlbum])
{
UIImagePickerController *imagePicker =
[[UIImagePickerController alloc] init];
imagePicker.delegate = self;
imagePicker.sourceType =
UIImagePickerControllerSourceTypePhotoLibrary;
imagePicker.mediaTypes = [NSArray arrayWithObjects:
(NSString *) kUTTypeImage,
nil];
imagePicker.allowsEditing = NO;
[self presentViewController:imagePicker animated:YES completion:nil];
newMedia = NO;
}
}
-(void)imagePickerControllerDidCancel:
(UIImagePickerController *)picker
{
[self dismissViewControllerAnimated:YES completion:nil];
}
-(void)imagePickerController:(UIImagePickerController *)picker
didFinishPickingMediaWithInfo:(NSDictionary *)info
{
NSString *mediaType = [info
objectForKey:UIImagePickerControllerMediaType];
[self dismissViewControllerAnimated:YES completion:nil];
if ([mediaType isEqualToString:(NSString *)kUTTypeImage]) {
UIImage *image = [info
objectForKey:UIImagePickerControllerOriginalImage];
Uploadedimage.image=image;
if (newMedia)
UIImageWriteToSavedPhotosAlbum(image,
self,
#selector(image:finishedSavingWithError:contextInfo:),
nil);
}
else if ([mediaType isEqualToString:(NSString *)kUTTypeMovie])
{
// Code here to support video if enabled
}
UIImage *image = [info
objectForKey:UIImagePickerControllerOriginalImage];
// [self performSelector:#selector(uploadToServer) withObject:nil afterDelay:0.0];
XMPPMessage *message = [[XMPPMessage alloc] initWithType:XMPP_MESSAGE_TYPE_CHAT to:[self.contact jid]];
NSData *imageData = UIImagePNGRepresentation(image);
NSString *imageStr = [GTMBase64 stringByEncodingData:imageData];
//decoding
NSData *imageData2 = [GTMBase64 decodeString:imageStr];
[message addBody:imageStr];
[[[AppDelegate appDelegate] xmppStream] sendElement:message];
XMPPJID *myJID = [[[AppDelegate appDelegate] xmppStream] myJID];
[self addMessage:#{
XMPP_TIMESTAMP: [NSDate date],
XMPP_MESSAGE_USERNAME: [myJID bare],
XMPP_MESSAGE_TEXT: imageStr,
}];
[self.tableView reloadData];
[self scrollToBottom:true];
}
- (void)image:(UIImage *)image
finishedSavingWithError:(NSError *)error
contextInfo:(void *)contextInfo
{
if (error) {
UIAlertView *alert = [[UIAlertView alloc]
initWithTitle: #"Archivo guardado"
message: #"Error al guardar archivo"\
delegate: nil
cancelButtonTitle:#"Aceptar"
otherButtonTitles:nil];
[alert show];
}
}
I am getting an issue, the code it is showing
2014-10-14 11:01:21.973 Ucity[2907:60b] messages: (
{
text = "/9j/4AAQSkZJRgABAQAAAQABAAD/4QBYRXhpZgAATU0AKgAAAAgAAgESAAMAAAABAAEAAIdpAAQAAAABAAAAJgAAAAAAA6ABAAMAAAABAAEAAKACAAQAAAABAAAE9KADAAQAAAABAAAFcAAAAAD/2wBDAAEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQEBAQH/..."
I need to see the image there but for some reason its showing that text.
I am using GTMBase 64 library
#import "GTMBase64.h"
Can someone help me to fix this problem?
That cryptic text is the image. It's just the base-64 string representation of the image. I assume you're doing this base-64 encoding for a reason (e.g. this format is required by some service to which you are uploading the image).
I'm presuming from your question that you want to show the image somewhere. I'm just trying to reconcile this with this code, in which you retrieved the image, converted it to a base-64 string, then discarded the original image, and now you're asking us why you're only seeing the string.
If you need the image again, there are a couple of options:
Keep the UIImage (or the NSData) that you grabbed in didFinishPickingMediaWithInfo.
You could alternatively convert the base-64 string back to a NSData (and then create a UIImage from that). This is a pretty convoluted approach, but it would work.
As an aside, if you wanted, you could probably replace GTMBase64.h with the native base-64 methods that Apple exposed in iOS 7. See https://stackoverflow.com/a/19794564/1271826.
Also, I don't personally like grabbing the UIImage and doing the PNG conversion to get the NSData. I always grab the original asset as shown here. This ensures there's no loss of information and that the resulting NSData isn't larger than it needs to be.

How do I save and load an image in Xcode 5 for iOS?

I've made an app for iPhone which is Flappy Bird-inspired. This app is made just so I can learn the programming behind app-making, and hopefully make an more original and advanced app soon.
The app can load a picture taken either from your Photo Library, or from your iPhone-Camera. I used this code:
- (IBAction)didTapPhoto:(UITapGestureRecognizer *)sender {
UIActionSheet *actionSheet = [[UIActionSheet alloc]initWithTitle:nil delegate:self cancelButtonTitle:#"Cancel" destructiveButtonTitle:nil otherButtonTitles:#"Take a Photo", #"Use Photo Library", nil];
[actionSheet showInView:self.view];
}
-(void) pickPhotoFromLibrary {
self.imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
[self.navigationController presentViewController:self.imagePicker animated:YES completion:nil];
}
-(void) takePhotoWithCamera {
self.imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
[self.navigationController presentViewController:self.imagePicker animated:YES completion:nil];
}
-(void) actionSheet:(UIActionSheet *)actionSheet clickedButtonAtIndex:(NSInteger)buttonIndex {
if (buttonIndex == actionSheet.cancelButtonIndex)return;
switch (buttonIndex) {
case 0:
[self takePhotoWithCamera];
break;
case 1:
[self pickPhotoFromLibrary];
default:
break;
}
}
-(void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[picker dismissViewControllerAnimated:YES completion:nil];
UIImage *image = info[UIImagePickerControllerOriginalImage];
self.imageView.image = image;
}
The question is: How do I save the picture which is loaded in an ImageView, and then load it in another ViewController?
I want the user to take a picture and then use themselves as the flappy bird. I have already made the Flappy Bird course, and used to different flappy birds.
The only issue is that I want it to be possible to save the picture selected by the user as a .png file, just like it was saved in Supporting Files. The picture can be saved as a default, for example #"image1", and in the other ViewController you can set that the ImageView load #"image1".
Save image to iPhone local file:
NSString *imagePath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
NSString *imageName = [imagePath stringByAppendingPathComponent:#"MainImage.jpg"];
NSData *imageData = UIImageJPEGRepresentation(imageView.image, 1.0);
BOOL result = [imageData writeToFile:imageName atomically:YES];
NSLog(#"Saved to %#? %#", imageName, (result? #"YES": #"NO"));
Load the saved image:
NSString *imagePath = [NSSearchPathForDirectoriesInDomains(NSDocumentDirectory, NSUserDomainMask, YES) lastObject];
NSString *imageName = [imagePath stringByAppendingPathComponent:#"MainImage.jpg"];
UIImage *image = [UIImage imageWithContentsOfFile:imageName];

UIImagePickercontroller not saving without use button

I'm using UIImagePickerController to take picuture and save to photo gallery. When i launch the picker it has the button to photo take and cancel after taking photo it shows 2 button Retake & use, if i use, use button then only image saving to photo album but after saving i can't go to previous page or close the picker.
-(void)takepicture:(id)sender{
// Create image picker controller
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
// Set source to the camera
imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
// Delegate is self
imagePicker.delegate = self;
// Show image picker
[self presentModalViewController:imagePicker animated:YES];
// [self performSelector:#selector(onTimer_Loadpicture:) withObject:nil afterDelay:0.5];
}
- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
// Access the uncropped image from info dictionary
UIImage *image = [info objectForKey:#"UIImagePickerControllerOriginalImage"];
// Save image
UIImageWriteToSavedPhotosAlbum(image, self, #selector(image:didFinishSavingWithError:contextInfo:), nil);
// UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil);
[picker release];
}
- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker {
[self dismissModalViewControllerAnimated:YES];
}
- (void)image:(UIImage *)image didFinishSavingWithError:(NSError *)error contextInfo:(void *)contextInfo
{
UIAlertView *alert;
// Unable to save the image
if (error)
alert = [[UIAlertView alloc] initWithTitle:#"Error"
message:#"Unable to save image to Photo Album."
delegate:self cancelButtonTitle:#"Ok"
otherButtonTitles:nil];
else // All is well
alert = [[UIAlertView alloc] initWithTitle:#"Success"
message:#"Image saved to Photo Album."
delegate:self cancelButtonTitle:#"Ok"
otherButtonTitles:nil];
[alert show];
[alert release];
[self performSelector:#selector(onTimer_Loadpicture:) withObject:nil afterDelay:0.5];
}
just dismiss your view controller. like this ,update your didFinishPickingMediaWithInfo method
- (void) imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info
{
// Access the uncropped image from info dictionary
UIImage *image = [info objectForKey:#"UIImagePickerControllerOriginalImage"];
// Save image
UIImageWriteToSavedPhotosAlbum(image, self, #selector(image:didFinishSavingWithError:contextInfo:), nil);
// UIImageWriteToSavedPhotosAlbum(image, nil, nil, nil);
[picker dismissViewControllerAnimated:YES completion:NULL];
}
You are not dismissing your view controller.You should do like this and if part of this code is not necessary it is up to you that you want to check your image in imageView or not.If you do not want to check then simply remove the if part and use else part's code.
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)img editingInfo:(NSDictionary *)editingInfo{
[self dismissModalViewControllerAnimated:YES];
_imgview.image = [editingInfo valueForKey:#"UIImagePickerControllerOriginalImage"];
if(_imgview==nil){
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Angry!!!" message:#"Vennligst velg et bilde!" delegate:nil cancelButtonTitle:#"Ok" otherButtonTitles:nil];
[alert show];
}
else{
_imgview.image = img;
imageData=[self compressImage:img];
[picker dismissModalViewControllerAnimated:YES];
_lblname.hidden=true;
}
return;
}

I want to use identifiers in .m in other .m (implementation file import) [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
On cameraviewcontrolle.mr I take a picture or movie using UIImagePickerController. On completion, I call back to aanvraagviewcontroller.m.
I want to save the the picture by tapping on send button.
My question comes to this I think, how can I import .m file or take the picture/movie to aanvraagviewcontroller.m (I use Parse.com to save my PFObjects)?
This is cameraviewcontroller.m
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
NSString *mediaType = [info objectForKey:UIImagePickerControllerMediaType];
if ([mediaType isEqualToString:(NSString *)kUTTypeImage]) {
// A photo was taken/selected!
self.image = [info objectForKey:UIImagePickerControllerOriginalImage];
if (self.imagePicker.sourceType == UIImagePickerControllerSourceTypeCamera) {
// Save the image!
UIImageWriteToSavedPhotosAlbum(self.image, nil, nil, nil);
}
}
else {
// A video was taken/selected!
self.videoFilePath = (__bridge NSString *)([[info objectForKey:UIImagePickerControllerMediaURL] path]);
if (self.imagePicker.sourceType == UIImagePickerControllerSourceTypeCamera) {
// Save the video!
if (UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(self.videoFilePath)) {
UISaveVideoAtPathToSavedPhotosAlbum(self.videoFilePath, nil, nil, nil);
}
}
}
[self uploadMessage];
[self dismissViewControllerAnimated:YES completion:nil];
[self.navigationController popToRootViewControllerAnimated:YES];}
- (void)uploadMessage {
NSData *fileData;
NSString *fileName;
NSString *fileType;
if (self.image != nil) {
UIImage *newImage = [self resizeImage:self.image toWidth:320.0f andHeight:480.0f];
fileData = UIImagePNGRepresentation(newImage);
fileName = #"image.png";
fileType = #"image";
}
else {
fileData = [NSData dataWithContentsOfFile:self.videoFilePath];
fileName = #"video.mov";
fileType = #"video";
}
PFFile *file = [PFFile fileWithName:fileName data:fileData];
[file saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
if (error) {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:#"An error occurred!"
message:#"Please try sending your message again."
delegate:self cancelButtonTitle:#"OK" otherButtonTitles:nil];
[alertView show];
}
else {// onderdeelAanvraag[#"file"] = file;
// onderdeelAanvraag[#"fileType"] = fileType;
// onderdeelAanvraag[#"recipientIDs"] = self.recipients;
//
if (error) {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:#"An error occurred!"
message:#"Please try sending your message again."
delegate:self cancelButtonTitle:#"OK" otherButtonTitles:nil];
[alertView show];
}
else {
// Everything was successful!
[self reset];
}
// }];
}
}];
}
- (void)reset {
self.image = nil;
self.videoFilePath = nil;
[self.recipients removeAllObjects];
}
- (UIImage *)resizeImage:(UIImage *)image toWidth:(float)width andHeight:(float)height {
CGSize newSize = CGSizeMake(width, height);
CGRect newRectangle = CGRectMake(0, 0, width, height);
UIGraphicsBeginImageContext(newSize);
[self.image drawInRect:newRectangle];
UIImage *resizedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return resizedImage;
}
This is aanvraagviewcontroller.m (when send button is pressed, i want to save the picture/movie here);
- (IBAction)verstuurAanvraag:(id)sender {
NSString *onderdeelOmschrijving = self.onderdeelOmschrijvingField.text ;
NSString *autoOmschrijving = self.autoOmschrijvingField.text ;
if ([onderdeelOmschrijving length] == 0 ||
[autoOmschrijving length] == 0)
{
UIAlertView *alertView = [[ UIAlertView alloc] initWithTitle:#"Leeg veld" message:#"Vul de lege velden in" delegate:nil cancelButtonTitle:#"OK" otherButtonTitles: nil];
[alertView show];
}
else {
PFObject *onderdeelAanvraag = [PFObject objectWithClassName:#"Aanvragen"];
[onderdeelAanvraag setObject:[PFUser currentUser] forKey:#"Aanvrager"];
onderdeelAanvraag[#"OnderdeelOmschrijving"] = onderdeelOmschrijving;
onderdeelAanvraag[#"AutoOmschrijving"] = autoOmschrijving;
NSDate *date = [NSDate date];
onderdeelAanvraag[#"Datum"] =date;
onderdeelAanvraag[#"file"] = file;
onderdeelAanvraag[#"fileType"] = fileType;
onderdeelAanvraag[#"recipientIDs"] = self.recipients;
// Get random number between 0 and 999999
int nummer = arc4random() % 100000;
NSLog(#"nieuw nummer %d", nummer);
[onderdeelAanvraag setObject:[NSNumber numberWithInt:nummer] forKey:#"AanvraagNummer"];
[onderdeelAanvraag saveInBackgroundWithBlock:^(BOOL succeeded, NSError *error) {
if (error) {
UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:#"Sorry!" message: [error.userInfo objectForKey:#"error"] delegate:nil cancelButtonTitle:#"OK" otherButtonTitles:nil];
[alertView show];
}
else {
[self performSegueWithIdentifier:#"showRecipients" sender:self];
}
}];
}
}
I SOLVED PASSING UITEXTFIELD TEXT BY THIS ;
I solved passing textfield data passing with the segue method like here ;
-(void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender{
if([segue.identifier isEqualToString:#"showRecipients"]){
OntvangersViewController *controller;
controller = [segue destinationViewController];
controller.onderdeelOmschrijvingField = self.onderdeelOmschrijvingField;
controller.autoOmschrijvingField = self.autoOmschrijvingField;
controller.image = self.image;
controller.videoFilePath = self.videoFilePath;
NSLog(#"videofilepath %#", self.videoFilePath);
controller.recipients = self.recipients;
}
}
Your question is muddled and confused.
The code in a .m file is not shared with other .m files.
The whole point of the C .h header file is that the header file can be shared, while the implementation (.c, or .m for Objective C) is private, and not shared.
If you want a value to be visible to another class, or another object of the same class, you should define a property in the header file.
If you want to pass a value from one view controller to another, this topic has been covered Ad nauseam here and on other forums. There are at least 2 comments on your post pointing you to other threads covering the topic.

UIImagePickerController disable iPhone 4S face detection (iOS 5.1)

I am currently developing an iPhone app that makes use of a UIImagePickerController with a custom overlay to take photos.
Unfortunately I do not have direct access to an iPhone 4S but several testers have reported that the camera picker is drawing a green border around faces exactly like this: http://cdn.iphonehacks.com/wp-content/uploads/2012/03/camera_faces.jpg
Due to the nature of this app this is not desirable.
A thorough search of the UIImagePickerController docs didn't turn up anything and similarly everything I could find on here relating to face detection was providing instructions in how to use a CIDetector or similar.
How can I disable face detection in my UIImagePickerController?
Here is my initialisation code for the UIImagePickerController:
UIImagePickerController *cameraPicker = [[UIImagePickerController alloc] init];
[cameraPicker setSourceType:UIImagePickerControllerSourceTypeCamera];
[cameraPicker setCameraDevice:UIImagePickerControllerCameraDeviceRear];
if ([UIImagePickerController isFlashAvailableForCameraDevice:cameraPicker.cameraDevice]){
[cameraPicker setCameraFlashMode:UIImagePickerControllerCameraFlashModeOn];
}
[cameraPicker setShowsCameraControls:NO];
[cameraPicker setCameraOverlayView:cameraOverlayView];
cameraPicker.delegate = self;
[self presentModalViewController:cameraPicker animated:YES];
Try This -->
Lets Say We have one UIViewController named as - RecordVideoViewController
Implementation of -- RecordVideoViewController.h
#import <UIKit/UIKit.h>
#import <MediaPlayer/MediaPlayer.h>
#import <MobileCoreServices/UTCoreTypes.h>
#import <AssetsLibrary/AssetsLibrary.h>
#interface RecordVideoViewController : UIViewController
- (IBAction)recordAndPlay:(id)sender;
-(BOOL)startCameraControllerFromViewController:(UIViewController*)controllerusingDelegate:
(id)delegate;
-(void)video:(NSString *)videoPath didFinishSavingWithError:(NSError *)error
contextInfo(void*)contextInfo;
#end
Implementation of -- RecordVideoViewController.m
- (IBAction)recordAndPlay:(id)sender {
[self startCameraControllerFromViewController:self usingDelegate:self];
}
-(BOOL)startCameraControllerFromViewController:(UIViewController*)controller
usingDelegate:(id )delegate
{
// 1 - Validattions
if (([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera] ==
NO)
|| (delegate == nil)
|| (controller == nil)) {
return NO;
}
// 2 - Get image picker
UIImagePickerController *cameraUI = [[UIImagePickerController alloc] init];
cameraUI.sourceType = UIImagePickerControllerSourceTypeCamera;
// Displays a control that allows the user to choose movie capture
cameraUI.mediaTypes = [[NSArray alloc] initWithObjects:(NSString *)kUTTypeMovie, nil];
// Hides the controls for moving & scaling pictures, or for
// trimming movies. To instead show the controls, use YES.
cameraUI.allowsEditing = NO;
cameraUI.delegate = delegate;
// 3 - Display image picker
[controller presentViewController:cameraUI animated:YES completion:nil];
return YES;
}
-(void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:
(NSDictionary *)info {
NSString *mediaType = [info objectForKey: UIImagePickerControllerMediaType];
[self dismissViewControllerAnimated:YES completion:nil];
// Handle a movie capture
if (CFStringCompare ((__bridge_retained CFStringRef) mediaType, kUTTypeMovie, 0) ==
kCFCompareEqualTo) {
NSString *moviePath = [[info objectForKey:UIImagePickerControllerMediaURL] path];
if (UIVideoAtPathIsCompatibleWithSavedPhotosAlbum(moviePath)) {
UISaveVideoAtPathToSavedPhotosAlbum(moviePath,
self,#selector(video:didFinishSavingWithError:contextInfo:),nil);
}
}
}
-(void)video:(NSString*)videoPath didFinishSavingWithError:(NSError*)error contextInfo:
(void*)contextInfo {
if (error) {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Error" message:#"Video Saving
Failed"
delegate:nil cancelButtonTitle:#"OK" otherButtonTitles:nil];
[alert show];
} else {
UIAlertView *alert = [[UIAlertView alloc] initWithTitle:#"Video Saved" message:#"Saved To
Photo Album" delegate:self cancelButtonTitle:#"OK" otherButtonTitles:nil];
[alert show];
}
}
Implement This code it, i hope this will help you .
Check out this post. There are some hints here, but still can't find much info outside of Apple's docs on this API.
Proper usage of CIDetectorTracking

Resources