Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/xcode/7.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
如何添加按钮";上传“;在Iphone中使用摄像头时?_Iphone_Xcode_Camera_Uiimagepickercontroller - Fatal编程技术网

如何添加按钮";上传“;在Iphone中使用摄像头时?

如何添加按钮";上传“;在Iphone中使用摄像头时?,iphone,xcode,camera,uiimagepickercontroller,Iphone,Xcode,Camera,Uiimagepickercontroller,我有一个tableView,我想在点击其中一个单元格时拍摄一张照片,并将其上传到某个服务器。 到目前为止,我已经做到了: - (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath { //do actions UIImagePickerController *picker = [[UIImagePickerController alloc] init]; // Se

我有一个tableView,我想在点击其中一个单元格时拍摄一张照片,并将其上传到某个服务器。 到目前为止,我已经做到了:

- (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应用程序)
顺便说一句,当我在使用中单击时,它会返回到表视图,但是图像在哪里?它是否保存在picker中?

您在image picker controller的委托方法中获得图像
-(无效)imagePickerController:(UIImagePickerController*)PickerDidFinishPickingImage:(UIImage*)img编辑信息:(NSDictionary*)编辑信息
{
//在此处编写代码,将图像保存在UIImage对象中,例如:-
UIImage*myImage=img;
//从此处添加上载按钮,或者如果您以前创建了上载按钮并将ti设置为隐藏,则将其隐藏属性设置为false

}

您可以通过图像选择器控制器的委托方法获取图像
-(无效)imagePickerController:(UIImagePickerController*)PickerDidFinishPickingImage:(UIImage*)img编辑信息:(NSDictionary*)编辑信息
{
//在此处编写代码,将图像保存在UIImage对象中,例如:-
UIImage*myImage=img;
//从此处添加上载按钮,或者如果您以前创建了上载按钮并将ti设置为隐藏,则将其隐藏属性设置为false

}

也许我没有很好地解释自己,但下面是我尝试做的一个例子(通过添加上传按钮自定义相机的外观):
谢谢。

也许我没有很好地解释我自己,但下面是一个我尝试做的示例(通过添加上传按钮自定义相机的外观):
谢谢。

非常感谢。我现在可以得到图像了。但我真的不知道如何添加按钮。当我点击“使用”时,我希望“使用”按钮变成“上传”按钮。但现在,当我单击“使用”时,它会返回到tableview。如何添加按钮?UIButton*uploadButton=[UIButton Button类型:UIButtonTypeRoundRect];感谢您仅从开始添加uploadbutton。但请将其隐藏。当拍摄图像并调用委托方法时,您将检查是否收到图像。如果您的图像对象不是nil,则再次将hidden设置为false,即show upload button,然后单击按钮后,在uploadbutton clicked方法中再次隐藏它。非常感谢。我现在可以得到图像了。但我真的不知道如何添加按钮。当我点击“使用”时,我希望“使用”按钮变成“上传”按钮。但现在,当我单击“使用”时,它会返回到tableview。如何添加按钮?UIButton*uploadButton=[UIButton Button类型:UIButtonTypeRoundRect];感谢您仅从开始添加uploadbutton。但请将其隐藏。当拍摄图像并调用委托方法时,您将检查是否收到图像。如果图像对象不是nil,则再次将hidden设置为false,即显示上载按钮,然后单击按钮后,在uploadbutton clicked方法中再次将其隐藏。