Pregunta

I am using QLPreviewController for displaying documents, to remove the share button i am subclassing QLPreviewController like below,

@interface QuickLookViewController : QLPreviewController{

}

And i am using the class as Below

QuickLookViewController *previewer = [[QuickLookViewController alloc] init];
// Set data source
[previewer setDataSource:self];
// Which item to preview
[previewer setCurrentPreviewItemIndex:indexPath.row];
// Push new viewcontroller, previewing the document
[[self navigationController] pushViewController:previewer animated:YES];

But the data source methods are not calling.

Can any one help me.

¿Fue útil?

Solución

Your interface has to tell that it's implementing the callbacks

@interface QuickLookViewController : QLPreviewController
<QLPreviewControllerDataSource, QLPreviewControllerDelegate>

Add the protocal names inside arrow brackets after the class name

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top