English 中文(简体)
iphone sdk camera overlay animation, how can stop in preview?
原标题:

I ve made an animation over the camera and all works fine. I can start the camera, move the image in overlay, and save it as a picture.

My problem is that in the "preview" the animation keeps on moving, and I don t know when camera enters in this mode. I don t know how to check a bool or do something that can stop overlay.

Is there any way to skeep preview? Or does it exist some function that shows me the camera state?

Thanks for your time.

// camera declaration
{
 UIImagePickerController *imagePicker;

 imagePicker = [[UIImagePickerController alloc] init];
 imagePicker.sourceType = UIImagePickerControllerSourceTypeCamera;
 imagePicker.delegate = self;
 imagePicker.showsCameraControls = YES;
 imagePicker.navigationBarHidden = YES;
 imagePicker.toolbarHidden = YES;

 imagePicker.cameraOverlayView = overlayView;

 [self presentModalViewController:imagePicker animated:YES];
 [self.view bringSubviewToFront:overlayView];
}



// animation
UIImageView *ani1;
ani1 = [[[UIImageView alloc] initWithImage:[UIImage imageNamed:@"ani1.png"]] autorelease];
[self.overlayView addSubview:ani1];

// loop for animation
[NSTimer scheduledTimerWithTimeInterval:0.05f target:self selector:@selector(loop) userInfo:nil repeats:YES];


-(void)loop {
// move x y each loop
newFrame = CGRectMake(x, y, 320, 480);
[ani1 setFrame:newFrame];
}



// camera finish
// take photo + overlay and save it
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo
{
imagePicker.showsCameraControls = NO;
[self presentModalViewController:imagePicker animated:NO];
[self.view bringSubviewToFront:overlayView];

UIGraphicsBeginImageContext(picker.view.bounds.size);
[picker.view.layer renderInContext:UIGraphicsGetCurrentContext()];
UIImage *newImage;
newImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

UIImageWriteToSavedPhotosAlbum(newImage, nil, nil, nil);
}
问题回答

You would have to create your one buttons and not use apple s default buttons and features of the UIImagePickerController.





相关问题
images sliding continuously with <table> and jQuery

I m trying to write a little test page that circulates images through a window (see image). I have colored boxes inside a table (gray border), with each box being a element. <table id="boxes" ...

WPF 3d rotation animations

I have a few 3d rectangles on my screen that I want to pivot around the Y axis. I want to press down with the mouse, and rotate the 3d object to a max rotation, but when the user moves their mouse, ...

Disable Windows 7 touch animation in WPF

In Windows 7 when you touch the screen there is a short animation that occurs at the touch point. In my WPF app I want to display my own touch points, without showing the one supplied by Windows. ...

jQuery block moving

I wanna move a div block to the top, so I coded like this: CSS part: .movingPart{ margin-top:80px; } jQuery part: $(document).ready(function() { $( #btn ).click(function() { $( .movingPart )....

Direct 2D gnuplot PNG animation?

Can anyone please confirm that yes/no Gnuplot 4.5 (on CVS) can output 2D animated PNG files? I have numerous datasets but one line that I d like to show iteratively in 3 different places in my graph. ...

Visual State Manager VS Animations in WPF

There is a lot of talk about the simplicity of Visual States and the transitions between them in WPF/Silverlight. I have the need to generate animations dynamically at runtime, to animate the ...

Create a ImageIcon that is the mirror of another one

I ll like to know if there is a way to create a ImageIcon that is the mirror of another ImageIcon. Searching on Google, I found how to do it by using many AWT libraries. Is there a way to do it with ...

how to drag in the animation in iphone application?

Iphone application is using the static co-ordinates to reach at some points in the application,which is based on the button event. But what i want is when i drag the item than it should reach at some ...

热门标签