Kev*_*ado 7 objective-c quicklook ios
我正在使用QuickLook查看PDF文件.
它在iOS 7.1中正常工作,但iOS 8 GM会出现一些问题.
图片比文字好,我想告诉你问题:
iOS 7.1 Xcode 6(工作正常)
使用QuickLook进行转换(没有失败)

页面滚动,navigationBar隐藏得很好

-------------------------------------------------- ------------------------
而现在,iOS 8 GM与Xcode 6
使用QuickLook进行过渡...

页面滚动,navigationBar不隐藏,页面指示器隐藏在NavigationBar后面

与iPhone模拟器,iPad模拟器,iPhone设备和iPad设备相同的问题.
你可以在这里看到我的源代码:
- (NSInteger)numberOfPreviewItemsInPreviewController:(QLPreviewController *)previewController
{
NSInteger numToPreview = 0;
if (currentSection == CVSectionConvocations)
numToPreview = self.convocation.convocations.count;
else if (currentSection == CVSectionAttachments)
numToPreview = self.convocation.attachements.count;
return numToPreview;
}
- (id)previewController:(QLPreviewController *)previewController previewItemAtIndex:(NSInteger)idx
{
PDF *pdf;
if (currentSection == CVSectionConvocations)
pdf = self.convocation.convocations[idx];
else if (currentSection == CVSectionAttachments)
pdf = self.convocation.attachements[idx];
return [pdf path];
}
- (void)collectionView:(UICollectionView *)collectionView didSelectItemAtIndexPath:(NSIndexPath *)indexPath {
// determine section
currentSection = (indexPath.section == 0 ? CVSectionConvocations : CVSectionAttachments);
PDF *pdf;
if (currentSection == CVSectionConvocations)
pdf = self.convocation.convocations[indexPath.row];
else if (currentSection == CVSectionAttachments)
pdf = self.convocation.attachements[indexPath.row];
if ([pdf isStored]) {
QLPreviewController *previewController = [[QLPreviewController alloc] init];
previewController.dataSource = self;
previewController.delegate = self;
previewController.currentPreviewItemIndex = indexPath.row;
[[self navigationController] pushViewController:previewController animated:YES];
} else {
[self displayMessage:@"Document not found" title:@"Oups !"];
}
}
Run Code Online (Sandbox Code Playgroud)
谢谢你的帮助 ;)
我最近已经能够修复背景问题错误(动画仍然不稳定)。
为了解决“黑色背景”问题,我在推送时设置了导航控制器视图的自定义背景颜色。当返回到我的视图控制器时,我确保将原始背景颜色恢复为零。
- (void)viewWillApear:(BOOL)animated {
[super viewWillApear:animated];
self.navigationController.view.backgroundColor = nil;
// Optional - In order to ease the animation bug
self.view.alpha = 1.0;
}
- (void)viewWillDissapear:(BOOL)animated {
[super viewWillDissapear:animated];
self.navigationController.view.backgroundColor = [UIColor whiteColor];
// Optional - In order to ease the animation bug
[UIView animateWithDuration:0.35 animations:^{
self.view.alpha = 0.0;
}];
}
Run Code Online (Sandbox Code Playgroud)
此代码应该转到您要从中推送 QLPreviewController 的视图控制器。
这个解决方案绝对是最好的解决方案,但希望它能有所帮助!
| 归档时间: |
|
| 查看次数: |
4051 次 |
| 最近记录: |