0

I want to show the power point presentation in iphone .

Is this possible ? because I want to show it in the slide show manner .

I however able to show ppt in the webView . but it is in the vertical manner .

I think if i convert all ppt into images and then show that images into scrollbar but i don't know if this is possible .

so if anyone have idea about this . please share here

Edit..

I am using UIDocumentInteractionController but I am unable to see the ppt .. this is the code ..

NSString * path = [[NSBundle mainBundle] pathForResource:@"Sun2" ofType:@"ppt"];

UIDocumentInteractionController *docController = [UIDocumentInteractionController interactionControllerWithURL:[NSURL fileURLWithPath:path]];
docController.delegate = self;
[docController retain];
BOOL isValid = [docController presentOpenInMenuFromRect:CGRectZero inView:self.view animated:YES];  
Jean-Luc Godard
  • 1,873
  • 3
  • 28
  • 53
  • You could do as you have described, or an easy way to achieve document loading would be to use a UIDocumentInteractionController. – Luke Nov 09 '11 at 10:12
  • will UIDocumentInteractionController allow me to view the slide show ? – Jean-Luc Godard Nov 09 '11 at 10:29
  • Just email/copy the powerpoint to your phone (email it to yourself) and then open the attachment. (providing you do not have any other document viewers/editor apps) The way it opens will use Apple's default UIDocumentInteractionController - you can scroll slide by slide and it will rotate and allow for zooming/printing etc. – Luke Nov 09 '11 at 10:36
  • Hey .. Luke I am trying that ..I have used the code mentioned above but still I am unable to open the ppt from the app .. and I have declared the delegate also – Jean-Luc Godard Nov 09 '11 at 10:38
  • You need to implement the delegate method: documentInteractionControllerViewControllerForPreview. You can see it in action here: http://stackoverflow.com/questions/6152764/uidocumentinteractioncontroller-crashing-upon-exit or check the class reference docs online. – Luke Nov 09 '11 at 10:45
  • Hey luke .. I mailed a ppt to myself and tried to open it but it is opening in another webPage .. and okay I will use that delgate method now – Jean-Luc Godard Nov 09 '11 at 10:49
  • okay ... I put the whole code which was in the init into the viewDidAppear but still I get the white screen only .. and the bool is always NO – Jean-Luc Godard Nov 09 '11 at 11:14
  • The code in my question was all within a new class file. The code in my init is very similar to what you have posted and looks fine. Once the delegate is set to self, you need to implement this: -(UIViewController *)documentInteractionControllerViewControllerForPreview: (UIDocumentInteractionController *) controller { return self; } so that it knows which view controller to load the document on top of. – Luke Nov 09 '11 at 11:30
  • well I did that .. your code was the same one I wanted to use .. so I used your code .. and self is already there .. but still I am getting the plain white screen – Jean-Luc Godard Nov 09 '11 at 11:43
  • So it's loading an empty controller window? Or nothing happens? I know you are saying the delegate is set to self, but did you cope/paste the delegate method which returns self (where self is a view controller)? Does this method get hit? – Luke Nov 09 '11 at 11:50
  • yes it is only a plain white view and you are right the delegate doesnt get called .. I am setting delegate but that method doesnt get called – Jean-Luc Godard Nov 09 '11 at 12:10
  • Could you explain your use of the bool you have? Rather than a direct call to: [docController presentPreviewAnimated: YES] straight after the set delegate call? – Luke Nov 09 '11 at 12:19
  • Oh... I was calling that `[docController presentPreviewAnimated: YES]` in ViewDidLoad and was allocating it in ViewDidAppear .. So It had no memory in ViewDidLoad.. now did it and it is working now ..write down the last answer so I can accept it... and one more thing .. this ppt is scrolling vertically I want it to scroll Horizontally .. is it possible?? – Jean-Luc Godard Nov 09 '11 at 12:30
  • posted as an answer :) glad it's working! Not sure you can override the scrolling - unless you forced the app (or the view controller) to only load in a landscape orientation - then you'll be scrolling the slides down or up. – Luke Nov 09 '11 at 13:54

1 Answers1

1

You could write some functions that do exactly as you have described, or consider the use of Apple's own UIDocumentInteractionController.

Be sure to implement the delegate method:

(UIViewController*)documentInteractionControllerViewControllerForPreview: (UIDocumentInteractionController*)controller

... which will return the view controller that is to push the document controller.

You may also find some of the code in an old question of mine to be helpful:

UIDocumentInteractionController crashing upon exit

Community
  • 1
  • 1
Luke
  • 11,426
  • 43
  • 60
  • 69