I just started developing iPhone. I studied in textbooks and materials from books to understand how to do it right. I come from the background of PHP and Java ... Objective-C is a bit freaky. But I learn best when my legs are wet.
Basically, I have these actions. getPhoto is bound to several UIBarButtonItems, in my opinion.
-(IBAction) getPhoto:(id) sender {
UIImagePickerController * picker = [[UIImagePickerController alloc] init];
picker.delegate = self;
if((UIBarButtonItem *) sender == choosePhoto) {
picker.sourceType = UIImagePickerControllerSourceTypeSavedPhotosAlbum;
} else {
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
}
[self presentModalViewController:picker animated:YES];
}
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingMediaWithInfo:(NSDictionary *)info {
[picker dismissModalViewControllerAnimated:YES];
theimageView.image = [info objectForKey:@"UIImagePickerControllerOriginalImage"];
}
My goal is to trigger the same action after starting the application, automatically opening the camera. How can i do this?
source
share