1
我有一個帶有主表視圖和詳細視圖的分割視圖。在我的分割視圖的主視圖的導航欄上,我有一個按鈕,可讓用戶通過imagePicker拍攝圖片。但是當我按下按鈕時,我的程序不斷崩潰。這裏的MasterViewController.m的過程當按鈕被按下時調用:帶有SplitViewController的iPad上的iOS ImagePicker
-(void) takePicture:(id) sender
{
UIImagePickerController *imagePicker = [[UIImagePickerController alloc] init];
if([UIImagePickerController isSourceTypeAvailable:UIImagePickerControllerSourceTypeCamera])
{
[imagePicker setSourceType:UIImagePickerControllerSourceTypeCamera];
}
else
{
[imagePicker setSourceType:UIImagePickerControllerSourceTypePhotoLibrary];
}
[imagePicker setDelegate:self];
//[self presentViewController:imagePicker animated:YES completion:nil];
if(UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad)
{
UIPopoverController * popOverController = [[UIPopoverController alloc] initWithContentViewController:imagePicker];
[popOverController presentPopoverFromRect:((UIButton *)sender).frame inView:self.view permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
//[popOverController presentPopoverFromRect:CGRectMake(700, 1000, 10, 10) inView:self.detailViewController.imageSpace permittedArrowDirections:UIPopoverArrowDirectionAny animated:YES];
}else {
[self presentViewController:imagePicker animated:YES completion:nil];
}
}
和這裏的錯誤消息:
2013-02-11 09:06:43.975 ImageSplit2[13044:c07] -[UIBarButtonItem frame]: unrecognized selector sent to instance 0x7183d00
2013-02-11 09:06:43.976 ImageSplit2[13044:c07] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[UIBarButtonItem frame]: unrecognized selector sent to instance 0x7183d00'
謝謝,這是我需要什麼和第二獎勵,使我的程序會更好。) – DarkCell 2013-02-11 21:21:55