【发布时间】:2014-12-02 10:16:18
【问题描述】:
我尝试显示一个 FPPopover,为此我需要一个 parentView。第一次尝试一切都很好。但是在 QuicklLookViewController 中显示 PDF 后,windows 中的子视图数量为 0,所以我无法掌握最后一个元素将其用作 parentView... 使用 NSLog 我可以看到我的视图层次结构的最后一个对象是隐藏的,解释大概为什么count是0。lastObject好像是这种新的UITextEffectsWindow...
FPPopoverController.m
初始化方法
NSArray *windows = [UIApplication sharedApplication].windows;
if(windows.count > 0)
{
_parentView=nil;
_window = [windows lastObject];
NSLog(@"Window.subviews count: %d", _window.subviews.count); // --> return 1 if no PDF was previously seen with QuickLook --> So popover is displayed the first time.
//keep the first subview
if(_window.subviews.count > 0) // ---> subviews.count is 0 after displaying a PDF with QuickLook --> method not called the second time and popover is not displayed
{
_parentView = [_window.subviews lastObject];
[_parentView addSubview:self.view];
[_viewController viewDidAppear:YES];
NSLog(@"windows: %@" "window: %@", _windows, _window); // --> I can see that the last element is hidden after displaying the PDF (something not present before I display PDF with QuickLook...)
NSLog(@"Parentview: %@", _parentView);
}
任何想法为什么会发生这种情况?我无法弄清楚为什么 QuickLook 不返回子视图或隐藏它们......有什么办法可以规避这个问题?
【问题讨论】:
标签: ios hidden subview uipopover quicklook