我有一个观点层次结构:
有两个孩子的compView:
bgView
的ObjectView。
我将objectView传递给UIImagePickerController的cameraOverlayView属性。一旦ImagePicker完成,我更新了bgView中的图像,我想继续显示视图树,包括作为overlayView传递给UIImagePickerController的objectView。
问题是在调用dismissModalViewControllerAnimated以关闭UIImagePickerController之后,objectView没有出现,好像UIImagePickerContoller正在隐藏它。我检查了调试器,它似乎没有被处理。指针仍然有效。但是观点没有显示出来。
我可能做错了什么想法?
谢谢, 涡
这里有一些代码可以告诉你我在做什么:
来自myViewController.m:
- (void)loadView {
CGRect rect = self.navigationController.view.bounds;
compView = [[UIView alloc] initWithFrame:rect];
bgView = [[UIImageView alloc] initWithImage:[UIImage imageNamed:@"Storage/dummy_bg.png"]];
objectView = [[PropImageView alloc] initWithImage:[UIImage imageNamed:@"Storage/rasta.png"]];
[objectView setUserInteractionEnabled:YES];
[objectView setMultipleTouchEnabled:YES];
[compView addSubview:bgView];
[compView addSubview:objectView];
self.view = compView;
[self placeObject];
[objectView release];
[bgView release];
[compView release];
}
- (void) placeObject
{
NSLog(@"camera button pressed");
// make sure camera is avaialble before setting it as source
//
if ([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera]) {
#if !TARGET_IPHONE_SIMULATOR
UIImagePickerController* picker = [[UIImagePickerController alloc] init];
picker.sourceType = UIImagePickerControllerSourceTypeCamera;
picker.delegate = self;
picker.allowsEditing = NO;
picker.view.hidden = NO;
picker.cameraOverlayView = objectView;
[self presentModalViewController:picker animated:NO];
[picker release];
#endif
}
// from PickImageAppDelegate.m
- (void)imagePickerController:(UIImagePickerController *)picker didFinishPickingImage:(UIImage *)image editingInfo:(NSDictionary *)editingInfo
{
// Dismiss the image selection, hide the picker and
[picker dismissModalViewControllerAnimated:YES];
bgView.image = [self rotateImage:image byOrientationFlag:UIImageOrientationRight];
}
答案 0 :(得分:0)
[picker dismissModalViewControllerAnimated:YES];
那应该是
[self dismissModalViewControllerAnimated:YES];