我有一个tableView,我想单击其中一个单元格并将其上传到某个服务器时拍照。 我已成功地做到这一点至今:在iPhone中使用相机时如何添加按钮“上传”?
- (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 cuz 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];
}
它启动相机并拍摄照片,但我想获得点击时,“使用”的“上传”按钮,可以你帮我?它是可行的吗? (如Facebook应用程序) 顺便说一句,当我点击使用它回到表视图,但图像在哪里?它是否保存在选择器中?
非常感谢。我现在可以获得图像。但我真的不知道如何添加按钮。当我点击使用时,我想使用按钮变成上传按钮。但是现在当我点击使用时,它会返回到tableview。我如何添加按钮? UIButton * uploadButton = [UIButton buttonWithType:UIButtonTypeRoundedRect];感谢 – nibon 2010-12-17 13:44:06
你只从头开始添加上传按钮,但保持隐藏状态。拍摄图像并调用委托方法时,检查是否收到了图像。如果你的图像对象不是零,然后再次设置隐藏为假,即显示上传按钮,然后一旦按钮被点击,再次以上传按钮单击的方法隐藏它。 – 2010-12-17 14:11:19