我无法得到这个:
我可以在xcode上“关闭”imagePickerController吗? 这是打开相机的代码,它完美地工作..
-(IBAction) startcamera {
imagePickerController = [[UIImagePickerController alloc] init];
imagePickerController.sourceType = UIImagePickerControllerSourceTypeCamera;
imagePickerController.allowsEditing = NO;
imagePickerController.showsCameraControls=NO;
imagePickerController.toolbarHidden=YES ;
imagePickerController.wantsFullScreenLayout=YES;
imagePickerController.cameraOverlayView=self.view;
self.imagePickerController.delegate=self;
[self presentModalViewController:imagePickerController animated:YES];
[imagePickerController release];
}
现在好了,说我想通过点击一个按钮关闭imagePickerController(意味着没有选择任何图像):我该怎么做? 试过:
-(IBAction)closecamera {
[imagePickerController release];
[imagePickerController dismissModalViewControllerAnimated:YES];
}
但它不起作用! 有线索吗? 提前致谢
答案 0 :(得分:3)
imagePickerController
两次。[self dismissModalViewControllerAnimated:YES];
答案 1 :(得分:1)
请勿释放它并在释放之前将其解除。 (比如说Ole)
但这也很重要......一旦你释放了一个对象,它就会消失,而且不能调用任何方法。