1

enter image description here

code snippets

   NSMutableArray *samplepdf = [[NSMutableArray alloc]initWithObjects:@"sam1.pdf",@"sam2.pdf",@"sam3.pdf",@"sam4.pdf", nil];


  1)  QLPreviewController *previewController = [[QLPreviewController alloc] init];
    previewController.dataSource = self;
    previewController.currentPreviewItemIndex = [indexPath row];
    [self presentModalViewController:previewController animated:YES];


2) 


- (NSInteger)numberOfPreviewItemsInPreviewController:(QLPreviewController *)previewController
{

    return [samplepdf count];

}


// returns the item that the preview controller should preview
- (id)previewController:(QLPreviewController *)previewController previewItemAtIndex:(NSInteger)index
{   

    NSString *documentsDirectoryPath = [[NSBundle mainBundle]resourcePath]; 

    NSString *dataPath =[documentsDirectoryPath stringByAppendingPathComponent:[samplepdf objectAtIndex:index]];


    NSURL *url = [NSURL fileURLWithPath:dataPath isDirectory:YES];  
    return url; 
}

This code Work perfectly in iOS5 ,but when iam running in ios6 some space is visible.

How can i solve this issue?

Thanks in Advance :)

Senthil
  • 510
  • 12
  • 28

1 Answers1

0

The call to presentModalViewController:animated: is deprecated in iOS6. You might want to specify a modal transition style and modal presentation style prior to calling presentViewController:animated:. You could try something like this:

  [previewController setModalPresentationStyle:UIModalPresentationFullScreen];
  [previewController setModalTransitionStyle:UIModalTransitionStyleFlipHorizontal];

  [self presentViewController:previewController animated:YES completion:nil];
Matt Long
  • 24,438
  • 4
  • 73
  • 99
  • Thanks for replying Matt Long,i am tried for this code and no effect. If any way to set zoom level in QLPreviewController ? – Senthil Feb 11 '13 at 09:56
  • I just noticed that your simulator is iPhone 5. Have you tested this code on the iPhone 4 simulator where the screen size is shorter? Do you get the same issue there? If not, you might want to look at http://stackoverflow.com/questions/12395200/how-to-develop-or-migrate-apps-for-iphone-5-screen-resolution – Matt Long Feb 11 '13 at 16:59