在UIPopover中显示ABPeoplePickerNavigationController

时间:2011-06-28 17:55:42

标签: iphone objective-c ios ipad

我有一个具有navigationController堆栈的UIPopover。从该堆栈中的第二个视图,我想在弹出窗口中以模态方式显示ABPeoplePickerNavigationController。我有这个工作,但当我解散modalViewController时,弹出窗口中缺少UIPoover的原始导航控制器。有没有办法使这项工作正常?代码如下:




   (IBAction)showPicker:(id)sender {
       ABPeoplePickerNavigationController *picker =
          [[ABPeoplePickerNavigationController alloc] init];
        picker.peoplePickerDelegate = self;

       picker.modalPresentationStyle = UIModalPresentationCurrentContext;
       picker.modalInPopover = YES;
       [self presentModalViewController:picker animated:YES];  
       // self is the 2nd viewController in the original navigation stack
       [picker release];
    }

    (void)peoplePickerNavigationControllerDidCancel:
       (ABPeoplePickerNavigationController *)peoplePicker {
            [self dismissModalViewControllerAnimated:YES];
     }

1 个答案:

答案 0 :(得分:0)

问题解决如下:

[self.navigationController presentModalViewController:picker animated:YES];