iphone - How to create viewController in PhoneGap to work with main view -


i want open file [uidocumentinteractioncontroller presentpreviewanimated];

i've created view controller

@interface fileviewcontroller : uiviewcontroller <uidocumentinteractioncontrollerdelegate>      @end    #import "fileviewcontroller.h"  @interface fileviewcontroller ()  @end  @implementation fileviewcontroller  - (id)initwithnibname:(nsstring *)nibnameornil bundle:(nsbundle *)nibbundleornil {     self = [super initwithnibname:nibnameornil bundle:nibbundleornil];     if (self) {         // custom initialization     }     return self; }     - (uiviewcontroller *) documentinteractioncontrollerviewcontrollerforpreview:(uidocumentinteractioncontroller *)controller {     return self; }  - (void)viewdidload {     [super viewdidload];     // additional setup after loading view. }  - (void)didreceivememorywarning {     [super didreceivememorywarning];     // dispose of resources can recreated. }  @end 

and trying preview file

uidocumentinteractioncontroller *controller = [uidocumentinteractioncontroller  interactioncontrollerwithurl:fileurl]; vcontroller = [[fileviewcontroller alloc] init]; controller.delegate = vcontroller; [controller presentpreviewanimated:yes]; 

and error:

warning: attempt present <qlpreviewcontroller: 0x1e56e0a0> on <fileviewcontroller: 0x1ec3e000> view not in window hierarchy! 

i may set root view controller

[[[[uiapplication sharedapplication] delegate] window] setrootviewcontroller:vcontroller]; 

but dont want use new view. need use phonegap's main view. how can this?

the problem solved

cdvviewcontroller* maincontroller = (cdvviewcontroller*)[ super viewcontroller ];  [maincontroller addchildviewcontroller:vcontroller]; 

Comments

Popular posts from this blog

monitor web browser programmatically in Android? -

Shrink a YouTube video to responsive width -

wpf - PdfWriter.GetInstance throws System.NullReferenceException -