0
votes

I am experimenting with various document types being displayed with a QLPreviewController but ive come across an issue with QLPreviewController not being able to switch between excel sheets if i have more that one document being fed to it,

self.fileNames = [NSArray arrayWithObjects:@"Doc1.xlsx",@"Doc2.html",@"Doc3.csv",@"Doc4.pdf",@"Doc.txt", nil];

//

- (id <QLPreviewItem>)previewController:(QLPreviewController *)controller previewItemAtIndex:(NSInteger)index
{
    NSString *contentURL = [[NSBundle mainBundle] pathForResource:[self.fileNames objectAtIndex:index] ofType:nil];
    return [NSURL fileURLWithPath:contentURL];
}
- (NSInteger) numberOfPreviewItemsInPreviewController:(QLPreviewController *)controller
{
    return [self.fileNames count];
}

If the number of preview items is set to 1 then you can navigate through all of the sheets of the xlsx file, but if the previewer has more than 1 doc then you can only zoom in and out.

Note this is an iOS 6 issue only, iOS 5 works as expected.

I get a feeling that it maybe to do with the changes to QLPreviewController to make it into a remote view controller and this effecting the gesture recogniser? (http://oleb.net/blog/2012/10/remote-view-controllers-in-ios-6/)

Any other ideas or known work arounds would be greatly appretiated.

1
This only happens if the xls/xlsx document is the first to be displayed, if it is anywhere else in the array it performs as expected.Jops
Although not a solution a work around it to put a blank document into the 0 position of the array of documents whenever a xls detected there, then on loading the view advance to the second page without an animation.Jops

1 Answers

1
votes

Although not a solution a work around it to put a blank document into the 0 position of the array of documents whenever a xls detected there, then on loading the view advance to the second page without an animation.