2012-07-12 128 views
1
AGImagePickerController *imagePickerController = [[AGImagePickerController alloc] initWithFailureBlock:^(NSError *error) { 

    if (error == nil) 
    { 
     NSLog(@"User has cancelled."); 
     [self dismissModalViewControllerAnimated:YES]; 
    } else 
    {  
     NSLog(@"Error: %@", error); 

     // Wait for the view controller to show first and hide it after that 
     double delayInSeconds = 0.5; 
     dispatch_time_t popTime = dispatch_time(DISPATCH_TIME_NOW, delayInSeconds * NSEC_PER_SEC); 
     dispatch_after(popTime, dispatch_get_main_queue(), ^(void){ 
      [self dismissModalViewControllerAnimated:YES]; 
     }); 
    } 

    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault animated:YES]; 

} andSuccessBlock:^(NSArray *info) { 
    NSLog(@"Info: %@", info); 
    [self dismissModalViewControllerAnimated:YES]; 

    [[UIApplication sharedApplication] setStatusBarStyle:UIStatusBarStyleDefault animated:YES]; 
}]; 

popover = [[UIPopoverController alloc] initWithContentViewController:imagePickerController]; 
[popover presentPopoverFromRect:CGRectMake(0.0, 0.0, 400.0, 400.0) 
         inView:self.view.window 
     permittedArrowDirections:UIPopoverArrowDirectionAny 
         animated:YES]; 

能夠提交,但是,即使我改變它的大小還是一樣的,當我按下按鈕DONE,它消除了我的視圖控制器不是imagepicker。請幫助。我把它放在popover中,因爲我認爲這就是爲什麼它放慢速度,因爲imagepicker應該與iPad的popover一起出現。圖像拾取酥料餅

回答

0

調整大小設置這樣說:

[popoverController setPopoverContentSize:CGSizeMake(1024, 500)]; 

然後在andSuccessBlock和你使用的其他部分:

[self dismissModalViewControllerAnimated:YES]; 

應該

[popoverController dismissPopoverAnimated:YES]; 

這就是爲什麼ViewController被解僱或從視圖中刪除,因爲它被錯誤地解僱了辦法。

1

你在實現AGImagePickerController委託嗎?

- (void)agImagePickerController:(AGImagePickerController *)picker didFinishPickingMediaWithInfo:(NSArray *)info; 

在那裏你可以關閉你的UIPopoverController

+0

我需要改變框架的彈出框 – Bazinga 2012-07-12 03:28:08

+0

我想你的意思是內容框架? 'setPopoverContentSize:animated:'或者你可以改變屬性'popoverController.contentSize = CGSizeMake(width,height)'[UIPopoverController Class Reference](http://developer.apple.com/library/ios/#documentation/uikit/reference /UIPopoverController_class/Reference/Reference.html) – ohr 2012-07-12 03:33:26