我正在開發一個應用程序,讓用戶從他自己的相冊中選擇圖片。它適用於iPhone,但不適用於iPad。UIPopoverController:dealloc在彈出窗口仍然可見時到達
我做了一個UIPopoverController
,它一切正常,用戶可以選擇一張照片,但是當用戶按下「USE」按鈕時。應用兌現一說
UIPopoverController的dealloc]達到,而酥料餅仍然可見
這裏是代碼:
- (void)choosePhotoFromLibraryipad:(id)sender{
if(![popoverController isPopoverVisible]){
imagePicker = [[UIImagePickerController alloc] init];
imagePicker.sourceType = UIImagePickerControllerSourceTypePhotoLibrary;
imagePicker.delegate = self;
imagePicker.allowsEditing = YES;
self.popoverController = [[UIPopoverController alloc] initWithContentViewController:imagePicker];
[self.popoverController presentPopoverFromRect:CGRectMake(0.0, 0.0, 400.0, 400.0)
inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES ];
}
}
你寫了'[popoverController dismissPopoverAnimated:YES];'當你想隱藏popover?請指定您使用的是否是ARC? – 2013-03-13 04:16:21
是的,我忘了做一個[popoverController dismissPopoverAnimated:YES]; 令人尷尬的:-D在這麼多小時後,它很容易 – 2013-03-13 21:38:54