Camera Parts

Fujifilm FinePix A345 41 MP Digital Camera Parts or Repair f s
Fujifilm FinePix A345 41 MP Digital Camera Parts or Repair f s
$11.95
Time Remaining: 42m

Nikon COOLPIX S4000 120 MP Digital Camera FOR PARTS READ
Nikon COOLPIX S4000 120 MP Digital Camera FOR PARTS READ
$19.99
Time Remaining: 18d 22h 50m
Buy It Now for only: $19.99

 Insignia digital camera gray 4x zoom NS DSC1112SL AS IS PARTS REPAIR untested
Insignia digital camera gray 4x zoom NS DSC1112SL AS IS PARTS REPAIR untested
$9.99
Time Remaining: 1h 6m

Canon PowerShot Digital ELPH SD1300 IS CAMERA FOR PARTS
Canon PowerShot Digital ELPH SD1300 IS CAMERA FOR PARTS
$19.99
Time Remaining: 14d 2h 30m
Buy It Now for only: $19.99

 Pentex Optio digital camera S4i silver 3x Zoom SMC lens AS IS PARTS REPAIR
Pentex Optio digital camera S4i silver 3x Zoom SMC lens AS IS PARTS REPAIR
$9.99
Time Remaining: 1h 13m

 Minolta Dimage G400 digital camera silver hexanon AS IS PARTS REPAIR UNTESTED
Minolta Dimage G400 digital camera silver hexanon AS IS PARTS REPAIR UNTESTED
$9.99
Time Remaining: 1h 18m

Canon PowerShot Digital ELPH SD1300 IS CAMERA FOR PARTS
Canon PowerShot Digital ELPH SD1300 IS CAMERA FOR PARTS
$19.99
Time Remaining: 24d 3h 57m
Buy It Now for only: $19.99

 Minolta Dimage Xt digital camera silver AS IS PARTS REPAIR UNTESTED
Minolta Dimage Xt digital camera silver AS IS PARTS REPAIR UNTESTED
$9.99 (1 Bid)
Time Remaining: 1h 22m

 Casio Exilim 81 Mega pixwl digital camera 3X zoom EX Z850 AS IS PARTS REPAIR
Casio Exilim 81 Mega pixwl digital camera 3X zoom EX Z850 AS IS PARTS REPAIR
$9.99
Time Remaining: 1h 26m

Casio EXILIM ZOOM EX Z600 60 MP Digital Camera AS IS for parts 148
Casio EXILIM ZOOM EX Z600 60 MP Digital Camera AS IS for parts 148
$10.00
Time Remaining: 13d 23h 47m
Buy It Now for only: $10.00

Nikon COOLPIX S203 100 MP Digital Camera Silver For Parts Not Working
Nikon COOLPIX S203 100 MP Digital Camera Silver For Parts Not Working
$14.99 (1 Bid)
Time Remaining: 1h 56m

GE C1033 101 MEGAPIXEL DIGITAL CAMERA FOR PARTS OR REPAIR
GE C1033 101 MEGAPIXEL DIGITAL CAMERA FOR PARTS OR REPAIR
$9.99
Time Remaining: 2h 8m

Canon PowerShot SX110 IS 90 MP Digital Camera Black Parts or Repair
Canon PowerShot SX110 IS 90 MP Digital Camera Black Parts or Repair
$50.00
Time Remaining: 27d 23h 57m
Buy It Now for only: $50.00

SAMSUNG SL202 102 MEGAPIXEL DIGITAL CAMERA FOR PARTS OR REPAIR
SAMSUNG SL202 102 MEGAPIXEL DIGITAL CAMERA FOR PARTS OR REPAIR
$9.99 (1 Bid)
Time Remaining: 2h 15m

SONY CYBER SHOT DSC W330 141 MEGAPIXEL DIGITAL CAMERA FOR PARTS OR REPAIR
SONY CYBER SHOT DSC W330 141 MEGAPIXEL DIGITAL CAMERA FOR PARTS OR REPAIR
$9.99 (1 Bid)
Time Remaining: 2h 18m

Sony Cyber shot DSC T90 121 MP Digital Camera Silver FOR PARTS
Sony Cyber shot DSC T90 121 MP Digital Camera Silver FOR PARTS
$29.99
Time Remaining: 17d 20h 2m
Buy It Now for only: $29.99

KODAK EASYSHARE M530 120 MEGAPIXEL DIGITAL CAMERA FOR PARTS OR REPAIR
KODAK EASYSHARE M530 120 MEGAPIXEL DIGITAL CAMERA FOR PARTS OR REPAIR
$9.99
Time Remaining: 2h 21m

CANON POWERSHOT SD1200 IS 100 MEGAPIXEL DIGITAL CAMERA FOR PARTS OR REPAIR
CANON POWERSHOT SD1200 IS 100 MEGAPIXEL DIGITAL CAMERA FOR PARTS OR REPAIR
$18.49 (3 Bids)
Time Remaining: 2h 22m

Nikon COOLPIX L22 120 MP Digital Camera Red FOR PARTS
Nikon COOLPIX L22 120 MP Digital Camera Red FOR PARTS
$19.99
Time Remaining: 14d 2h 19m
Buy It Now for only: $19.99

NIKON COOLPIX S570 120 MEGAPIXEL DIGITAL CAMERA FOR PARTS OR REPAIR WORKS
NIKON COOLPIX S570 120 MEGAPIXEL DIGITAL CAMERA FOR PARTS OR REPAIR WORKS
$13.50 (4 Bids)
Time Remaining: 2h 25m

SAMSUNG SL620 122 MEGAPIXEL DIGITAL CAMERA FOR PARTS OR REPAIR
SAMSUNG SL620 122 MEGAPIXEL DIGITAL CAMERA FOR PARTS OR REPAIR
$9.99
Time Remaining: 2h 26m

Nikon COOLPIX S210 80 MP Digital Camera AS IS for parts 146
Nikon COOLPIX S210 80 MP Digital Camera AS IS for parts 146
$10.00
Time Remaining: 13d 23h 45m
Buy It Now for only: $10.00

CANON POWERSHOT SD1300 IS 121 MEGAPIXEL DIGITAL CAMERA FOR PARTS OR REPAIR
CANON POWERSHOT SD1300 IS 121 MEGAPIXEL DIGITAL CAMERA FOR PARTS OR REPAIR
$12.00 (4 Bids)
Time Remaining: 2h 28m

SONY CYBER SHOT DSC W180 101 MEGAPIXEL DIGITAL CAMERA FOR PARTS OR REPAIR
SONY CYBER SHOT DSC W180 101 MEGAPIXEL DIGITAL CAMERA FOR PARTS OR REPAIR
$9.99
Time Remaining: 2h 30m

AS IS Canon EOS Digital Rebel XSi 122MP Digital SLR Camera For Parts Or Repair
AS IS Canon EOS Digital Rebel XSi 122MP Digital SLR Camera For Parts Or Repair
$195.00
Time Remaining: 2d 4h 19m
Buy It Now for only: $195.00

CANON POWERSHOT SD1400 IS 141 MEGAPIXEL DIGITAL CAMERA FOR PARTS OR REPAIR
CANON POWERSHOT SD1400 IS 141 MEGAPIXEL DIGITAL CAMERA FOR PARTS OR REPAIR
$15.50 (5 Bids)
Time Remaining: 2h 32m

Canon PowerShot A630 80 MP Digital Camera Silver FOR PARTS
Canon PowerShot A630 80 MP Digital Camera Silver FOR PARTS
$39.99
Time Remaining: 14d 19h 57m
Buy It Now for only: $39.99

SAMSUNG ES80 120 MEGAPIXEL DIGITAL CAMERA FOR PARTS OR REPAIR
SAMSUNG ES80 120 MEGAPIXEL DIGITAL CAMERA FOR PARTS OR REPAIR
$9.99
Time Remaining: 2h 35m

CANON POWERSHOT SX120 IS 100 MEGAPIXEL DIGITAL CAMERA FOR PARTS OR REPAIR
CANON POWERSHOT SX120 IS 100 MEGAPIXEL DIGITAL CAMERA FOR PARTS OR REPAIR
$31.00 (6 Bids)
Time Remaining: 2h 37m

Pentax K100D 61 MP Digital SLR Camera Black Body Only FOR REPAIR OR PARTS
Pentax K100D 61 MP Digital SLR Camera Black Body Only FOR REPAIR OR PARTS
$98.00
Time Remaining: 11d 4h 9m
Buy It Now for only: $98.00

CANON POWERSHOT A3100 IS 121 MEGAPIXEL DIGITAL CAMERA FOR PARTS OR REPAIR
CANON POWERSHOT A3100 IS 121 MEGAPIXEL DIGITAL CAMERA FOR PARTS OR REPAIR
$9.99 (1 Bid)
Time Remaining: 2h 48m

Canon PowerShot ELPH100HS Camera broken for Parts
Canon PowerShot ELPH100HS Camera broken for Parts
$0.99 (2 Bids)
Time Remaining: 2h 55m

Canon EOS 7D 180 MP Digital SLR Camera Black Body Only FOR PARTS
Canon EOS 7D 180 MP Digital SLR Camera Black Body Only FOR PARTS
$999.99
Time Remaining: 17d 22h 42m
Buy It Now for only: $999.99

USED OLYMPUS FE 170 AND FE 210 DIGITAL CAMERA FOR PARTS NOT WORKING
USED OLYMPUS FE 170 AND FE 210 DIGITAL CAMERA FOR PARTS NOT WORKING
$6.00 (5 Bids)
Time Remaining: 2h 56m

Casio EXILIM EX S10 101 MP Digital Camera Red AS IS Broken Good Parts
Casio EXILIM EX S10 101 MP Digital Camera Red AS IS Broken Good Parts
$15.00
Time Remaining: 3h 45m
Buy It Now for only: $20.00

Olympus Stylus 770 SW 71 MP Underwater Digital Camera Silver AS IS PARTS
Olympus Stylus 770 SW 71 MP Underwater Digital Camera Silver AS IS PARTS
$19.99
Time Remaining: 24d 18h 18m
Buy It Now for only: $19.99

Nikon D3100 142 MP Digital SLR Camera Black Body FOR PARTS
Nikon D3100 142 MP Digital SLR Camera Black Body FOR PARTS
$190.00 (4 Bids)
Time Remaining: 4h 5m

Fujifilm FinePix Z33WP 100 MP Digital Camera Green parts only
Fujifilm FinePix Z33WP 100 MP Digital Camera Green parts only
$0.01 (1 Bid)
Time Remaining: 4h 37m

Nikon Coolpix L20 100 MP Digital Camera FOR PARTS
Nikon Coolpix L20 100 MP Digital Camera FOR PARTS
$14.99
Time Remaining: 22d 51m
Buy It Now for only: $14.99

3 SONY MAVICA CAMERAS FOR PARTS
3 SONY MAVICA CAMERAS FOR PARTS
$5.00
Time Remaining: 4h 50m

POLAROID M635 NON WORKING DIGITAL CAMERA AS IS PARTS
POLAROID M635 NON WORKING DIGITAL CAMERA AS IS PARTS
$9.99
Time Remaining: 5h 6m
Buy It Now for only: $10.99

Sony Cyber shot DSC P200 72 MP 3x Zoom Digital Camera Silver AS IS PARTS REPAIR
Sony Cyber shot DSC P200 72 MP 3x Zoom Digital Camera Silver AS IS PARTS REPAIR
$19.99
Time Remaining: 23d 22h 2m
Buy It Now for only: $19.99

Kodak EASYSHARE C160 92 MP Digital Camera Teal BROKEN FOR PARTS
Kodak EASYSHARE C160 92 MP Digital Camera Teal BROKEN FOR PARTS
$10.00
Time Remaining: 5h 20m
Buy It Now for only: $50.00

Kodak EASYSHARE M1073 IS 102 MP Digital Camera Red Parts Repair
Kodak EASYSHARE M1073 IS 102 MP Digital Camera Red Parts Repair
$11.99
Time Remaining: 5h 47m

Casio Digital Camera QV R40 40 MP Mega Pixels Silver Broken Broke Parts
Casio Digital Camera QV R40 40 MP Mega Pixels Silver Broken Broke Parts
$12.99
Time Remaining: 28d 20h 26m
Buy It Now for only: $12.99

Sony U50 Used Colectible Not Working Digital Camera For Parts Only
Sony U50 Used Colectible Not Working Digital Camera For Parts Only
$20.00
Time Remaining: 7h 29m
Buy It Now for only: $80.00

Canon PowerShot A610 50 MP Digital Camera Parts Only
Canon PowerShot A610 50 MP Digital Camera Parts Only
$15.00
Time Remaining: 15h 15m

GE H855 80 MP 5x Optical Zoom Digital Camera Black AS IS PARTS
GE H855 80 MP 5x Optical Zoom Digital Camera Black AS IS PARTS
$14.99
Time Remaining: 16d 20h 45m
Buy It Now for only: $14.99

Kodak EASYSHARE M1063 103 MP Digital Camera Purple FOR PARTS OR REPAIR
Kodak EASYSHARE M1063 103 MP Digital Camera Purple FOR PARTS OR REPAIR
$9.99
Time Remaining: 15h 46m
Buy It Now for only: $14.99

Kodak EASYSHARE M763 72 MP Digital Camera Red FOR PARTS OR REPAIR
Kodak EASYSHARE M763 72 MP Digital Camera Red FOR PARTS OR REPAIR
$9.99
Time Remaining: 15h 47m
Buy It Now for only: $14.99

AS IS Nikon D80 102 MP Digital SLR Camera Body Only for parts or repair
AS IS Nikon D80 102 MP Digital SLR Camera Body Only for parts or repair
$225.00
Time Remaining: 28d 5h 29m
Buy It Now for only: $225.00

AS IS Broken Nikon Coolpix S220 Plum Digital Camera for Parts or Repair
AS IS Broken Nikon Coolpix S220 Plum Digital Camera for Parts or Repair
$1.79 (5 Bids)
Time Remaining: 16h 1m

Canon PowerShot A550 71 MP Digital Camera 4x Zoom Silver AS IS PARTS
Canon PowerShot A550 71 MP Digital Camera 4x Zoom Silver AS IS PARTS
$19.99
Time Remaining: 23d 18h 24m
Buy It Now for only: $19.99

Samsung L100 82 MP Digital Camera Pink for parts or repair
Samsung L100 82 MP Digital Camera Pink for parts or repair
$20.00
Time Remaining: 16h 8m

CANON A1000is 10 MP DIGITAL CAMERA W 10X ZOOM FOR REPAIR OR PARTS
CANON A1000is 10 MP DIGITAL CAMERA W 10X ZOOM FOR REPAIR OR PARTS
$9.95
Time Remaining: 16h 54m

Sony Cyber shot DSC T50 72 MP Digital Camera AS IS DEFECTIVE PARTS
Sony Cyber shot DSC T50 72 MP Digital Camera AS IS DEFECTIVE PARTS
$14.99
Time Remaining: 16d 21h 59m
Buy It Now for only: $14.99

Olympus D 360L 13 Megapixel Camera Parts or Repair
Olympus D 360L 13 Megapixel Camera Parts or Repair
$0.99
Time Remaining: 17h 33m

Polaroid T737 70 MP Digital Camera Black FOR PARTS OR REPAIR
Polaroid T737 70 MP Digital Camera Black FOR PARTS OR REPAIR
$0.99 (1 Bid)
Time Remaining: 17h 38m

AS IS Nikon Coolpix S550 Camera Repair Parts Lens Error Broken
AS IS Nikon Coolpix S550 Camera Repair Parts Lens Error Broken
$34.99
Time Remaining: 4d 22h 59m
Buy It Now for only: $34.99

Polaroid M737t 70 MP Digital Camera Gray FOR PARTS OR REPAIR NO POWER
Polaroid M737t 70 MP Digital Camera Gray FOR PARTS OR REPAIR NO POWER
$0.99 (2 Bids)
Time Remaining: 17h 38m

Polaroid M737t 70 MP Digital Camera Gray FOR PARTS OR REPAIR GOOD LCD SCREEN
Polaroid M737t 70 MP Digital Camera Gray FOR PARTS OR REPAIR GOOD LCD SCREEN
$6.99
Time Remaining: 17h 39m
Buy It Now for only: $8.99

Canon EOS Digital Rebel XS 1000D 101 MP Digital SLR Camera FOR PARTS
Canon EOS Digital Rebel XS 1000D 101 MP Digital SLR Camera FOR PARTS
$149.99
Time Remaining: 5d 21h 27m
Buy It Now for only: $149.99

Olympus FE 210 71 MP Digital Camera SEE PICS NOT WORKING FOR PARTS FAST SHIP
Olympus FE 210 71 MP Digital Camera SEE PICS NOT WORKING FOR PARTS FAST SHIP
$5.00
Time Remaining: 17h 43m
Buy It Now for only: $7.00

Canon Powershot S30 Digital Camera spare parts faulty As Is
Canon Powershot S30 Digital Camera spare parts faulty As Is
$1.57
Time Remaining: 19h 5m

Konica Minolta DiMage Xg 32 Mega Pixel Digital Camera BROKEN PARTS REPAIR
Konica Minolta DiMage Xg 32 Mega Pixel Digital Camera BROKEN PARTS REPAIR
$14.97
Time Remaining: 6d 7h 39m
Buy It Now for only: $14.97

Samsung SH100 140 MP Digital Camera Black Screen Broken For Parts
Samsung SH100 140 MP Digital Camera Black Screen Broken For Parts
$9.95 (1 Bid)
Time Remaining: 19h 8m

Olympus CAMEDIA 4000 Zoom 40 MP Digital Camera 4 parts
Olympus CAMEDIA 4000 Zoom 40 MP Digital Camera 4 parts
$5.00
Time Remaining: 19h 49m
Buy It Now for only: $10.00

AS IS Sony Cyber Shot DSC T900 Camera Repair Parts Broken Error ASIS
AS IS Sony Cyber Shot DSC T900 Camera Repair Parts Broken Error ASIS
$44.99
Time Remaining: 7d 22h 47m
Buy It Now for only: $44.99

Canon PowerShot SD750 Elph Camera Qty2 TWO Dead AS IS Parts Broken 2 CB 2LV
Canon PowerShot SD750 Elph Camera Qty2 TWO Dead AS IS Parts Broken 2 CB 2LV
$19.99
Time Remaining: 20h 14m
Buy It Now for only: $49.99

Sony Cyber shot DSC W50 60 MP camera 1GB card plus parts cam  extra battery
Sony Cyber shot DSC W50 60 MP camera 1GB card plus parts cam extra battery
$25.00 (1 Bid)
Time Remaining: 20h 21m

Fujifilm FinePix S1 PRO 32 MP Digital SLR Camera Black Body Only FOR PARTS
Fujifilm FinePix S1 PRO 32 MP Digital SLR Camera Black Body Only FOR PARTS
$68.00
Time Remaining: 28d 2h 17m
Buy It Now for only: $68.00

7 Sony Mavica Digital Still Camera for PARTS OR SERVICE REPAIR Big Lot
7 Sony Mavica Digital Still Camera for PARTS OR SERVICE REPAIR Big Lot
$4.99
Time Remaining: 20h 37m

Sony Mavica MVC FD7 10x Digital Still Camera For Parts
Sony Mavica MVC FD7 10x Digital Still Camera For Parts
$2.49
Time Remaining: 20h 49m
Buy It Now for only: $6.99

Fujifilm Finepix S2 Pro 61Mp Digital Camera Body for Parts or Repair
Fujifilm Finepix S2 Pro 61Mp Digital Camera Body for Parts or Repair
$65.50
Time Remaining: 9d 22h 3m
Buy It Now for only: $65.50

Sony Cyber shot DSC H50 91 MP Digital Camera FOR PARTS
Sony Cyber shot DSC H50 91 MP Digital Camera FOR PARTS
$69.00
Time Remaining: 21h
Buy It Now for only: $85.00

Account limit of 2039 requests per hour exceeded.

Custom Camera Applications Development Using Iphone Sdk

iPhone contains many useful features. One of them is build-in camera and Camera application system for making photos. It looks great but what about camera usage with native applications? iPhone SDK provides the capability of using camera through UIImagePickerController class. That’s great but there is a small disadvantage - you cannot create a full-screen persistent “live” camera view like the Camera application does. Instead of that you should use UIImagePickerController only in modal mode - show the pop-up modal view when you need a photo and close the view after the photo is made. You have to reopen this view again to take the next one.

Moreover, that modal view contains additional panels and controls that overlay the camera view. Another disadvantage is - you cannot take a photo in one touch; you need to touch the Shoot button to take a picture and preview it, and then you need to touch the Save button to get the photo for processing. Probably it’s the best practice but I don’t like it and I hope you think the same way.

What about using the UIImagePickerController as an ordinal non-modal view controller under the navigation controller the same way as we use the other view controllers? Try it and you will found that it works! The camera view works and looks as it should. You can assign a delegate and process UIImagePickerControllerDelegate events to get and save the photo. Ok, touch the Shoot button, touch the Save button - great, you’ve got the photo! But just look at this - the Retake and Save buttons stay above the camera view, and they don’t work now when they are touched… This is because you cannot reset the view to take another photo after taking one and touching the Save button, the view is freezed and the buttons are disabled. It seems you need to fully recreate the UIImagePickerController instance to take another photo. That’s not so simple and not so good. And you still need to use the panels and buttons that overlay the camera view…

Now I have an idea! When we touch Shoot, the view stops refreshing and displays single image from the camera; then we have to touch Retake or Save button. Can we get that image and save it without using the UIImagePickerControllerDelegate and then touch the Retake button programmatically to reset the view and get another photo? Sure we can! If you explore the camera views hierarchy after touching Shoot you will find that there is a hidden view of ImageView type. This class is not described in the SDK, but we can explore its’ methods using Objective-C capabilities. We can see that the class contains a method called imageRef. Let’s try this… Yes, it returns CGImage object! And the image size is 1200 x 1600 - it’s definitely the camera picture!

Ok, now we know we can get the photo without UIImagePickerControllerDelegate. But in what moment should we do this? Can we catch the user touches on the Shoot button to start processing? It’s possible but not so good. Do you remember our main purpose – creating the persistent full-screen camera view like system Camera application does? It’s time to do it! When we explored the views hierarchy, we’ve found that there are number of views above the camera view. We can try to hide these views and create our own button below the camera view to take the photo in one touch. But how can we force the camera view to make the photo? It’s very simple - we can get the corresponding selector from the Shoot button and call it from our action handler!

Ok, we’ve forced getting the image. But it takes us few seconds. How can we detect that the image is ready? It occurred when the Cancel and Shoot buttons are replaced by Retake and Save ones. The simplest way to detect this is starting a timer with short interval and checking the buttons. And then we can get and save the photo, using the corresponding selector from the Retake button and calling it to reset the camera view and prepare it for making a new one. Here is the code:

// Shot button on the toolbar touched. Make the photo.
- (void)shotAction:(id)sender {
[self enableInterface:NO];
// Simulate touch on the Image Picker's Shot button
UIControl *camBtn = [self getCamShutButton];
[camBtn sendActionsForControlEvents:UIControlEventTouchUpInside];

// Set up timer to check the camera controls to detect when the image
// from the camera will be prepared.
// Image Picker's Shot button is passed as userInfo to compare with current button.
[NSTimer scheduledTimerWithTimeInterval:0.2 target:self selector:@selector(savePhotoTimerFireMethod:) userInfo:camBtn repeats:NO];
}

// Return Image Picker's Shoot button (the button that makes the photo).
- (UIControl*) getCamShutButton {

UIView *topView = [self findCamControlsLayerView:self.view];
UIView *buttonsBar = [topView.subviews objectAtIndex:2];
UIControl *btn = [buttonsBar.subviews objectAtIndex:1];

return btn;
}

// Return Image Picker's Retake button that appears after the user pressed Shoot.
- (UIControl*) getCamRetakeButton {

UIView *topView = [self findCamControlsLayerView:self.view];
UIView *buttonsBar = [topView.subviews objectAtIndex:2];
UIControl *btn = [buttonsBar.subviews objectAtIndex:0];

return btn;
}

// Find the view that contains the camera controls (buttons)
- (UIView*)findCamControlsLayerView:(UIView*)view {

Class cl = [view class];
NSString *desc = [cl description];
if ([desc compare:@"PLCropOverlay"] == NSOrderedSame)
return view;

for (NSUInteger i = 0; i < [view.subviews count]; i++)
{
UIView *subView = [view.subviews objectAtIndex:i];
subView = [self findCamControlsLayerView:subView];
if (subView)
return subView;
}

return nil;
}

// Called by the timer. Check the camera controls to detect that the image is ready.
- (void)savePhotoTimerFireMethod:(NSTimer*)theTimer {

// Compare current Image Picker's Shot button with passed.
UIControl *camBtn = [self getCamShutButton];
if (camBtn != [theTimer userInfo])
{
// The button replaced by Save button - the image is ready.
[self saveImageFromImageView];

// Simulate touch on Retake button to continue working; the camera is ready to take new photo.
camBtn = [self getCamRetakeButton];
[camBtn sendActionsForControlEvents:UIControlEventTouchUpInside];

[self enableInterface:YES];
}
else
{
NSTimeInterval interval = [theTimer timeInterval];
[NSTimer scheduledTimerWithTimeInterval:interval target:self selector:@selector(savePhotoTimerFireMethod:) userInfo:camBtn repeats:NO];
}
}

// Save taken image from hidden image view.
- (BOOL)saveImageFromImageView {

UIView *cameraView = [self.view.subviews objectAtIndex:0];
if ([self enumSubviewsToFindImageViewAndSavePhoto:cameraView])
return YES;

return NO;
}

// Recursive enumerate subviews to find hidden image view and save photo
- (BOOL)enumSubviewsToFindImageViewAndSavePhoto:(UIView*)view {

Class cl = [view class];
NSString *desc = [cl description];
if ([desc compare:@"ImageView"] == NSOrderedSame)
return [self grabPictureFromImageView:view];

for (int i = 0; i < [view.subviews count]; i++)
{
if ([self enumSubviewsToFindImageViewAndSavePhoto:[view.subviews objectAtIndex:i]])
return YES;
}

return NO;
}

// Grab the image from hidden image view and save the photo
- (BOOL)grabPictureFromImageView:(UIView*)view {

CGImageRef img = (CGImageRef)[view imageRef];
if (img)
{
// Taken image is in UIImageOrientationRight orientation
UIImage *photo = [self correctImageOrientation:img];
UIImageWriteToSavedPhotosAlbum(photo, nil, nil, nil);

return YES;
}

return NO;
}

// Correct image orientation from UIImageOrientationRight (rotate on 90 degrees)
- (UIImage*)correctImageOrientation:(CGImageRef)image {

CGFloat width = CGImageGetWidth(image);
CGFloat height = CGImageGetHeight(image);
CGRect bounds = CGRectMake(0.0f, 0.0f, width, height);

CGFloat boundHeight = bounds.size.height;
bounds.size.height = bounds.size.width;
bounds.size.width = boundHeight;

CGAffineTransform transform = CGAffineTransformMakeTranslation(height, 0.0f);
transform = CGAffineTransformRotate(transform, M_PI / 2.0f);

UIGraphicsBeginImageContext(bounds.size);

CGContextRef context = UIGraphicsGetCurrentContext();

CGContextScaleCTM(context, - 1.0f, 1.0f);
CGContextTranslateCTM(context, -height, 0.0f);
CGContextConcatCTM(context, transform);

CGContextDrawImage(context, CGRectMake(0.0f, 0.0f, width, height), image);

UIImage *imageCopy = UIGraphicsGetImageFromCurrentImageContext();

UIGraphicsEndImageContext();

return imageCopy;
}

Another important question is: in what moment can we hide the overlaying camera views and controls and create our own button? Trying the viewDidLoad… Oops… The camera view is still not created. Trying the viewWillAppear… The same thing… Trying the viewDidAppear… Yes, the views have been created and can be hidden now. Ok, we hide that and create a toolbar with our Shoot button. It works, but the screen flicks - we see how the standard views and buttons are shown and then hidden. How can we prevent this? I tried a number of ways and had found the best one: we should hide the views before they are added to the camera view (when the addSubview method of the camera view is called). It’s possible using Objective-C capability to replace the method dynamically at run-time. Ok, let’s replace the addSubview by our own method. In our method we can check that the passed view is one of the camera view subviews and set its’ “hidden” property to YES. So, we replace the addSubview in the viewWillAppear before the camera view is created. And we create our toolbar and Shoot button in the viewDidAppear after the camera view is created. Take a look at the code below:

// Replace "addSubview:" if called first time; hide camera controls otherwise.
- (void)viewWillAppear:(BOOL)animated {

[super viewWillAppear:animated];

if (toolBar != nil)
{
// The view was already appeared; we don't need to subclass UIView
// but need to hide extra camera controls.
UIView *cameraView = [self findCamControlsLayerView:self.view];
if (cameraView)
{
cameraView = cameraView.superview;
int cnt = [cameraView.subviews count];
if (cnt >= 4)
{
for (int i = 2; i < cnt - 1; i++)
{
UIView *v = [cameraView.subviews objectAtIndex:i];
v.hidden = YES;
}
}
}
}
else
{
// Subclass UIView and replace addSubview to hide the camera view controls on fly.
[RootViewController exchangeAddSubViewFor:self.view];
}
}

// Exchange addSubview: of UIView class; set our own myAddSubview instead
+ (void)exchangeAddSubViewFor:(UIView*)view {

SEL addSubviewSel = @selector(addSubview:);
Method originalAddSubviewMethod = class_getInstanceMethod([view class], addSubviewSel);

SEL myAddSubviewSel = @selector(myAddSubview:);
Method replacedAddSubviewMethod = class_getInstanceMethod([self class], myAddSubviewSel);

method_exchangeImplementations(originalAddSubviewMethod, replacedAddSubviewMethod);
}

// Add the subview to view; "self" points to the parent view.
// Set "hidden" to YES if the subview is the camera controls view.
- (void) myAddSubview:(UIView*)view {

UIView *parent = (UIView*)self;

BOOL done = NO;
Class cl = [view class];
NSString *desc = [cl description];

if ([desc compare:@"PLCropOverlay"] == NSOrderedSame)
{
for (NSUInteger i = 0; i < [view.subviews count]; i++)
{
UIView *v = [view.subviews objectAtIndex:i];
v.hidden = YES;
}

done = YES;
}

[RootViewController exchangeAddSubViewFor:parent];

[parent addSubview:view];

if (!done)
[RootViewController exchangeAddSubViewFor:parent];
}

The technique described above was used in iUniqable application available from Apple App Store (Social Networking section). Feel free to use.

Feel free to visit the website of the developer www.enterra-inc.com

About the Author

Vladimir Tarassyuk

DIY Steadicam with instant, simple, low cost camera parts

Leave a comment

You must be logged in to post a comment.