Advertise Mobile SDKs Books Events Forum News Social Networking Support Us
Follow @iphonedevsdk on Twitter

Interface 2, Advanced iOS
Mockup & Code Gen
($9.99)

Make your own iPhone apps
and run them live!
(free)

Pic Frame Dynamo: Photo Editing
($0.99)

Abiliator
($1.99)

Want your application or service advertised on iPhone Dev SDK?

Go Back   iPhone Dev SDK Forum > iPhone SDK Development Forums > iPhone SDK Development

Reply
 
LinkBack Thread Tools Display Modes
Old 05-26-2011, 04:48 AM   #1 (permalink)
Registered Member
 
Join Date: Feb 2011
Posts: 17
anupam is on a distinguished road
Default How to customize the camera API

HI

I want to make an application which can customize the UIImagePickerCOntroller class.

Till now what I did is

Code:
			//create an overlay view instance
			PhotoLayoutView* overlay = [[PhotoLayoutView alloc]initWithFrame:CGRectMake(0, 0, 320, 480)];
			
			// create the picker
			UIImagePickerController* picker1 = [[UIImagePickerController alloc] init];
			//[picker1 setAllowsEditing:YES];
			[picker1 setSourceType:UIImagePickerControllerSourceTypeCamera];
			[picker1 setDelegate:self];
			
			//hide all controls
			picker1.showsCameraControls = NO;
			picker1.navigationBarHidden = YES;
			picker1.toolbarHidden = YES;
			//make the video preview full size
			picker1.wantsFullScreenLayout = YES;
			picker1.cameraViewTransform =
			CGAffineTransformScale(picker1.cameraViewTransform,
								   1,
								   1.34299);
			//set our custom overlay view
			picker1.cameraOverlayView = overlay;
			[self presentModalViewController:picker1 animated:YES];
			[picker1 release];
PhotoLayout is another class for the overlay which has a button

Code:
- (id)initWithFrame:(CGRect)frame {
    if (self = [super initWithFrame:frame]) {
        //clear the background color of the overlay
        self.opaque = NO;
        self.backgroundColor = [UIColor clearColor];

		
        //add a simple button to the overview with no functionality at the moment
        ScanButton *scanButton = [[ScanButton alloc] initWithFrame:CGRectMake(10, 400, 157, 50)];
		
		// Add a target action for the button:
		[scanButton addTarget:self action:@selector(btnClicked) forControlEvents:UIControlEventTouchUpInside];
		
		 [self addSubview:scanButton];
    }
    return self;
}

- (void) btnClicked {

}
ScanButton class is where I put the image to the button

Code:
@implementation ScanButton

- (id)initWithFrame:(CGRect)frame {
	if (self = [super initWithFrame:frame]) {
		// Set button image:
		UIImageView *buttonImage = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, 157, 57)];
		buttonImage.image = [UIImage imageNamed:@"capture.png"];
		
		//[self addTarget:self action:@selector(buttonPressed) forControlEvents:UIControlEventTouchUpInside];
		
		// TODO: Change opacity when being touched:
		
		[self addSubview:buttonImage];
		
	}
	return self;
}


My first problem is the button is not showing in the view when i open the camera second is how can I call the takePicture method of UIImagePickerController with the btnClicked button in PhotoLayout class.
anupam is offline   Reply With Quote
Old 05-26-2011, 05:49 AM   #2 (permalink)
Reading the Documentation
 
baja_yu's Avatar
 
Join Date: Sep 2010
Location: 45.255019,19.844908
Posts: 5,414
baja_yu has a spectacular aura about
Default

Check out AVCam sample code from the documentation. It's more complex than using UIImagePickerControler but it'll allow you for much greater customization.
baja_yu is offline   Reply With Quote
Old 05-27-2011, 12:22 AM   #3 (permalink)
Registered Member
 
Join Date: Feb 2011
Posts: 17
anupam is on a distinguished road
Default

Quote:
Originally Posted by baja_yu View Post
Check out AVCam sample code from the documentation. It's more complex than using UIImagePickerControler but it'll allow you for much greater customization.
It shows 120 errors. Cant I use the UIImagePickerController for customization.
anupam is offline   Reply With Quote
Old 05-27-2011, 12:40 AM   #4 (permalink)
Registered Member
 
Join Date: May 2011
Posts: 3
marina edward is on a distinguished road
Default

look at AVCam sample code from the documentation
marina edward is offline   Reply With Quote
Old 05-27-2011, 05:57 AM   #5 (permalink)
Reading the Documentation
 
baja_yu's Avatar
 
Join Date: Sep 2010
Location: 45.255019,19.844908
Posts: 5,414
baja_yu has a spectacular aura about
Default

What errors? Runs fine for me. Are you running on the device?
baja_yu is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On



» Advertisements
» Online Users: 344
6 members and 338 guests
doffing81, dre, iOS.Lover, jenniead38, Kirkout, Wikiboo
Most users ever online was 1,387, 04-10-2012 at 04:21 AM.
» Stats
Members: 175,663
Threads: 94,120
Posts: 402,898
Top Poster: BrianSlick (7,990)
Welcome to our newest member, LezB44
Powered by vBadvanced CMPS v3.1.0

All times are GMT -5. The time now is 02:11 AM.
Powered by vBulletin® Version 3.8.0
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.3.0