0

I have a simple UIViewController and a UIButton on it. I would like that when pressing the button a custom UIView I created (using XIB) will be added in a modal way so no other control or button under could be pressed.

currently I do:

VODPopup *popup = [[VODPopup alloc] initWithFrame:CGRectMake(100, 95, 200, 150)   pickerData:vodEpisodesPickerData];

popup.delegate = self;

[self.view addSubview:popup];

Which adds to UIView instance as a subview to my ViewController, BUT all other buttons located outside the UIVIew are pressable.

any idea??

4

2 回答 2

1

如果你想要确切的行为,你可以使用 UIWindow:

    UIWindow *overlayWindow = [[UIWindow alloc] initWithFrame:[UIScreen mainScreen].bounds];
    overlayWindow.autoresizingMask = UIViewAutoresizingFlexibleWidth | UIViewAutoresizingFlexibleHeight;
    overlayWindow.backgroundColor = [UIColor colorWithWhite:0.f alpha:0.f];
    overlayWindow.windowLevel = UIWindowLevelAlert;
    [overlayWindow setHidden:FALSE];

但是如果你使用 ARC,你应该设置强指针。

于 2013-10-15T06:14:22.747 回答
0

在查看了几篇帖子后,最好的解决方案是创建一个透明的 UIViewController 并在顶部放置我的 UIView 并创建了一个 Modal Segue,当调用它时,它控制一切,只允许与它交互,而不是与下面的交互。

此链接可能会解决您的问题:-)

https://github.com/Chintan-Dave/popupDemo

于 2013-10-19T04:32:08.490 回答