0

我有一个应用程序,底部有一个工具栏,其中一个选项为Upload. 单击它时,PopOverController会出现一个显示可供选择的照片列表。

选择照片后,我想显示一个PopOverController包含照片的视图(在自身内部)以及名为Upload. 在选择我的照片时,目前我PopOverController并没有被解雇。我使用了以下代码行:

-(IBAction)photolibrarypressed:(id)sender{
    NSLog(@"hi");

    UIImagePickerController *picker= [[UIImagePickerController alloc] init];
    picker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
    picker.delegate = self;

    UIPopoverController *popover = [[UIPopoverController alloc] initWithContentViewController:picker];
    self.popoverController = popover;          
    popoverController.delegate = self;
    [popoverController presentPopoverFromBarButtonItem:sender permittedArrowDirections:UIPopoverArrowDirectionUp animated:YES];

    imageView = [[UIImageView alloc] initWithFrame:[window bounds]];


    [window addSubview:imageView];
    imageView.hidden = YES;
    [window makeKeyAndVisible];     
}

- (void)imagePickerController:(UIImagePickerController *)picker 
    didFinishPickingImage:(UIImage *)image
              editingInfo:(NSDictionary *)editingInfo
{
    imageView.image = image;    
    NSLog(@"hellow");
    [self dismissModalViewControllerAnimated:YES];

    // need to show the upload image button now
    upload.hidden = NO;
}

- (void)imagePickerControllerDidCancel:(UIImagePickerController *)picker
{
    [picker dismissModalViewControllerAnimated:YES];
    exit(0);
}

有人可以帮我解决问题吗?

4

1 回答 1

0

而不是打电话

 [self dismissModalViewControllerAnimated:YES];

调用与 int eh 取消方法相同的取消方法来处理解除它的模态视图

 [picker dismissModalViewControllerAnimated:YES]; // Dismisses modalView
于 2012-07-17T09:50:20.210 回答