Display ABPeoplePickerNavigationController using storyboard segue

前端 未结 3 1939
夕颜
夕颜 2021-01-05 06:21

I have a new project where I want to display a People Picker, when a button is touched.

So I have a UIButton that segues to a generic UIViewContro

3条回答
  •  死守一世寂寞
    2021-01-05 06:57

    Besi's answer is great. But it's less code to just use the old way instead of using a storyboard for it:

    - (void)showPeoplePicker:(id)sender
    {
        ABPeoplePickerNavigationController* picker = [[ABPeoplePickerNavigationController alloc] init];
        picker.peoplePickerDelegate = self;
        picker.modalPresentationStyle = UIModalPresentationFullScreen;
        picker.modalTransitionStyle = UIModalTransitionStyleFlipHorizontal;
        [self presentViewController:picker
                           animated:YES                     
                         completion:^{
                         // animation to show view controller has completed.
                         }];
    }
    

提交回复
热议问题