ios - Loading a popover view when app opens -


following along this tutorial, i'm trying make simple ios video app learn api. tutorial tell put button on view that, when pressed, uses uiimagepickercontroller api (a modal or popup view) show camera controls. app, wanted uiimagepickercontroller (or rather camera functionality) appear, not when button pressed, rather when app opened. when moved code viewdidload, got error message

2014-06-27 17:04:48.754 videoblah[33679:60b] warning: attempt present <uiimagepickercontroller: 0x1658d4d0> on <viewcontroller: 0x165be6f0> view not in window hierarchy! 

i therefore tried self.view presentviewcontroller this

[self.view presentviewcontroller:picker animated:yes completion:null]; 

but uiview doesn't have selector presentviewcontroller.

is there way popup view controller uiimagepickercontroller appear when app opens rather waiting user present button?

- (void)viewdidload {     [super viewdidload];     // additional setup after loading view, typically nib. //    if ([uiimagepickercontroller issourcetypeavailable:uiimagepickercontrollersourcetypecamera]) { //         //        uiimagepickercontroller *picker = [[uiimagepickercontroller alloc] init]; //        picker.delegate = self; //        picker.allowsediting = yes; //        picker.sourcetype = uiimagepickercontrollersourcetypecamera; //        picker.mediatypes = [[nsarray alloc] initwithobjects: (nsstring *) kuttypemovie, nil]; //         //        [self presentviewcontroller:picker animated:yes completion:null]; //    }  }  - (ibaction)capturevideo:(id)sender {     if ([uiimagepickercontroller issourcetypeavailable:uiimagepickercontrollersourcetypecamera]) {          uiimagepickercontroller *picker = [[uiimagepickercontroller alloc] init];         picker.delegate = self;         picker.allowsediting = yes;         picker.sourcetype = uiimagepickercontrollersourcetypecamera;         picker.mediatypes = [[nsarray alloc] initwithobjects: (nsstring *) kuttypemovie, nil];          [self presentviewcontroller:picker animated:yes completion:null];     } } 

try using code in viewdidappear.


Comments

Popular posts from this blog

javascript - RequestAnimationFrame not working when exiting fullscreen switching space on Safari -

Python ctypes access violation with const pointer arguments -