我嘗試顯示FPPopover,爲此我需要一個parentView。第一次嘗試時一切都很好。但在QuicklLookViewController顯示PDF之後,子視圖的窗口數爲0,所以我不能把握的最後一個元素使用它作爲parentView ......隨着我的NSLog可以看到我的視圖層次結構的最後一個對象是隱藏的,解釋也許就是爲什麼計數爲0。lastObject似乎是這種新型UITextEffectsWindow的...iOS版 - QuickLook的返回無窗子視圖
FPPopoverController.m
Init方法
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沒有返回子視圖或隱藏它們......有什麼方法可以繞過這個問題?
似乎更明智...謝謝 – Trichophyton 2014-12-03 21:01:38