不想解雇 UIPopover
我正在使用以下代码在我的 View 中显示一个弹出窗口,
imagePopOver = [[UIPopoverController alloc];
initWithContentViewController:self.photoLibraryImageCollection.imagePickerController];
imagePopOver.popoverContentSize = CGSizeMake(185,675);
imagePopOver.delegate = self;
[imagePopOver presentPopoverFromRect:CGRectMake(600,0, 140, 800)
inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionLeft animated:YES];
它工作正常,但是如果我们单击 myView 的任何其他部分,则显示的弹出窗口将消失。任何人都可以告诉我如何避免此问题。我任何时候都不想解雇它。任何人都可以告诉我该怎么做吗?
i am using this following code to display a popover in my View
imagePopOver = [[UIPopoverController alloc];
initWithContentViewController:self.photoLibraryImageCollection.imagePickerController];
imagePopOver.popoverContentSize = CGSizeMake(185,675);
imagePopOver.delegate = self;
[imagePopOver presentPopoverFromRect:CGRectMake(600,0, 140, 800)
inView:self.view
permittedArrowDirections:UIPopoverArrowDirectionLeft animated:YES];
it working fine however if we click any other part of myView ,this displayed popover is dismissing.can any one tell me how can i avoid this problem. i don't want to dismiss it at any time.can any one tell me how can do it.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在弹出窗口的委托(可能是您的 viewController)中,实现
不要忘记设置委托!
In the popover's delegate (your viewController, probably), implement
Don't forget to set the delegate!
只是在弹出窗口初始化时编写了以下代码。
上面代码中的myPopOver.passthroughViews = [NSArray arrayWithObject:self.view];
不会关闭您的 popOver,我们可以使用我们的视图。
如果您不想仅在编辑文本框时关闭 UIpopover,只需编写
myPopOver.passthroughViews = [NSArray arrayWithObject:self.textBox];
just wrote the below code at the time of popover initialization.
myPopOver.passthroughViews = [NSArray arrayWithObject:self.view];
in the above code will not dismiss your popOver and we can work with our View.
if you don't want to dismiss UIpopover only at the time of a textBox edit,simply write
myPopOver.passthroughViews = [NSArray arrayWithObject:self.textBox];