禁用单击后台UIViewController

时间:2013-04-26 06:41:50

标签: iphone ios uiviewcontroller uinavigationcontroller

点击ABPeoplePickerNavigationController时,我正在加载UITableViewCell

self.peoplePicker = [[ABPeoplePickerNavigationController alloc] init];
self.peoplePicker.peoplePickerDelegate = self;
[self.peoplePicker setDelegate:self];
self.peoplePicker.modalPresentationStyle = UIModalPresentationFormSheet;
[self presentViewController:self.peoplePicker animated:YES completion:nil];

当选择器显示为UIModalPresentationFormSheet时,我想要禁用它后面的UIViewController。为此,我可以在呈现选择器时加载透明视图,并在拾取器被解除时将其解除。所以在viewcontroller上点击不会工作。 我想知道是否有其他方法可以做到这一点,我不需要创建新的UIView并加载/关闭它。

1 个答案:

答案 0 :(得分:1)

在呈现之前和解除Picker视图之后,您可以在ViewController视图上setUserInteractionEnabled属性。