segue到视图控制器和它的内容之间的间隙显示- uiddocument



我有一个名为useDocument的方法,当我的视图控制器的属性(一个名为' document '的uiddocument子类)被设置时运行。方法如下:

- (void)useDocument
{
    if (![[NSFileManager defaultManager] fileExistsAtPath:self.document.fileURL.path]) {
        //
        //  Does not exist on disk, save
        //
        [self.document saveToURL:self.document.fileURL
                forSaveOperation:UIDocumentSaveForCreating
               completionHandler:^(BOOL success) {
                   if (!success) {
                       NSLog(@"Failed to create file at url: %@", self.document.fileURL);
                   } else {
                       NSLog(@"Created file at %@", self.document.fileURL);
                   }

               }];
    } else if (self.document.documentState == UIDocumentStateClosed) {
        //
        //  Document is closed, open
        //
        [self.document openWithCompletionHandler:^(BOOL success) {
            if (!success) {
                NSLog(@"Failed to open file at url: %@", self.document.fileURL);
            } else {
                NSLog(@"Opened file at %@", self.document.fileURL);
            }
        }];
    } else if (self.document.documentState == UIDocumentStateNormal) {
        //
        //  Document is ready to be used
        //
    }
}

视图控制器成功地被推到堆栈上并显示,但是当文件不存在并且必须保存时,在表示文件已保存的日志和出现的导航栏内容(UIBarButtonItem)之间有一个明显的间隙(大约11秒)

我还应该指出,UICollectionView在视图控制器显示自己。

有谁知道这是为什么吗?

以编程方式设置它,但如果有人有IB的解决方案,我宁愿听到它!

最新更新