How to add button "upload" when using Camera in Iphone?
I have a tableView, and I want to take a picture when clicking in one of the cells and upload it to a certain server. I have managed to do this so far:
- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath {
//do actions
UIImagePickerController *picker = [[UIImagePickerController alloc] init];
// Set the image picker source to the camera:
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
// Hide the camera controls:
picker.showsCameraControls = YES;
picker.navigationBarHidden = NO;
// Make the view full screen:
picker.wantsFullScreenLayout = YES;
//picker.cameraViewTransform = CGAffineTransformScale(picker.cameraViewTransform, CAMERA_TRANSFORM_X, CAMERA_TRANSFORM_Y);
// Now insert our overlay view (it has to be here 开发者_如何学Ccuz it's a modal view):
//picker.cameraOverlayView = overlayView;
matches *aMatch = [appDelegate.matches objectAtIndex:indexPath.row];
NSLog(@"%@", [NSString stringWithFormat:@"%d", aMatch.match_id]);
// Show the picker:
[self presentModalViewController:picker animated:YES];
[picker release];
}
It starts the camera and takes the picture, but I would like to get an "Upload" button when clicking in "use", can you help me? is it posible? (like the facebook app) By the way, whe I click in use it comes back to the table view, but where is the image? is it saved in picker?
you get your image in the delegate method of image picker controller
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)img editingInfo:(NSDictionary *)editInfo
{
//write your code here to save image in ur UIImage object for e.g:-
UIImage *myImage = img;
// add upload button from here or else set it hidden property to false if u have previously created upload button and had set ti to hidden
}
Maybe I didn't explain myself very good, but here is an example of what I was trying to do ( customize the look of the camera by adding an upload button): http://developer.apple.com/library/ios/#samplecode/PhotoPicker/Introduction/Intro.html%23//apple_ref/doc/uid/DTS40010196-Intro-DontLinkElementID_2 Thank you.
精彩评论