1
我有一个名为useDocument
的方法,它在我的视图控制器的属性(名为'document'的UIDocument子类)被设置时运行。这里的方法:在查看控制器及其内容之间的间隙显示 - UIDocument
- (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
//
}
}
视图控制器成功获取被推到堆栈和示出,但是当文件不存在,并已被保存,有之间的显着的间隙(约11秒)的日志说文件已被保存,导航栏内容出现(一个UIBarButtonItem
)
我还应该指出,视图控制器内的UICollectionView
显示自己。
有谁知道这可能是为什么?