iPhone code forUIImageViewControllerPickerSourceTypeCamera
Posted
by aman-gupta
on Stack Overflow
See other posts from Stack Overflow
or by aman-gupta
Published on 2010-01-18T09:24:54Z
Indexed on
2010/04/12
21:03 UTC
Read the original article
Hit count: 257
iphone
- (IBAction)pickAndDecode:(id) sender {
UIImagePickerControllerSourceType sourceType;
int i = [sender tag];
switch (i) {
case 0: sourceType = UIImagePickerControllerSourceTypeCamera; break;
case 1: sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum; break;
case 2: sourceType = UIImagePickerControllerSourceTypePhotoLibrary; break;
default: sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
}
[self pickAndDecodeFromSource:sourceType];
}
- (void) updateToolbar {
self.cameraBarItem.enabled = [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera];
self.savedPhotosBarItem.enabled = [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeSavedPhotosAlbum];
self.libraryBarItem.enabled = [UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypePhotoLibrary];
self.archiveBarItem.enabled = true;
self.actionBarItem.enabled = (self.result != nil) && ([self.result actions] != nil) && ([self.result actions].count > 0);
}
- (void)pickAndDecodeFromSource:(UIImagePickerControllerSourceType) sourceType {
[self reset];
// Create the Image Picker
if ([UIImagePickerController isSourceTypeAvailable:sourceType]) {
UIImagePickerController* picker = [[UIImagePickerController alloc] init];
picker.sourceType = sourceType;
picker.delegate = self;
picker.allowsImageEditing = YES; // [[NSUserDefaults standardUserDefaults] boolForKey:@"allowEditing"];
// Picker is displayed asynchronously.
[self presentModalViewController:picker animated:YES];
} else {
NSLog(@"Attempted to pick an image with illegal source type '%d'", sourceType);
}
}
Where I Put this line in my above codes; [picker setShowsCameraControls:FALSE];
please help me so that i can change the real view of iPhone camera according to my view which i have designed
© Stack Overflow or respective owner