image - ImagePicker removing views when dismissed iOS 8 -


my app structured central view controller adds 3 4 subviews main view. in 1 of added view controllers present camera user. when dismiss image picker, every subview except 1 in present camera (the view controller) disappears. think might related how app structured , view stack. app works fine when running ios 8 on iphone , ios 7 on ipad. having issue when running ios 8 on ipad. made sure code followed apple documentation on how present , dismiss image picker. here code used present image picker.

 -(ibaction)photobuttonpressed:(id)sender {      // prompt camera or photo library     // retrieve image , set button's default image     if ([uiimagepickercontroller issourcetypeavailable:uiimagepickercontrollersourcetypecamera]) {          uiimagepickercontroller *imagepicker =         [[uiimagepickercontroller alloc] init];          imagepicker.delegate = self;          imagepicker.sourcetype = uiimagepickercontrollersourcetypecamera;         imagepicker.mediatypes = [nsarray arraywithobjects:                                   (nsstring *) kuttypeimage, nil];          imagepicker.allowsediting = no;         imagepicker.modalpresentationstyle = uimodalpresentationfullscreen; //play around         [self presentviewcontroller:imagepicker animated:yes completion:nil];      } else {          uialertview *alert = [[uialertview alloc] initwithtitle:@"camera not found" message:@"there no camera available on device." delegate:nil cancelbuttontitle:@"ok" otherbuttontitles:nil];         [alert show];     } } 

code used dismiss

- (void)imagepickercontroller:(uiimagepickercontroller *)picker didfinishpickingmediawithinfo:(nsdictionary *)info     {         cgsize scalesize = cgsizemake(1024.0f, 1280.0f);         uiimage *capturedimage;          // handle still image capture         capturedimage = (uiimage *) [info objectforkey:                                      uiimagepickercontrolleroriginalimage];          [self dismissviewcontrolleranimated:yes completion:nil];           if (capturedimage) {             if ([[uidevice currentdevice] userinterfaceidiom] == uiuserinterfaceidiompad) {                 photodata = uiimagejpegrepresentation([capturedimage resizedimage:scalesize interpolationquality:kcginterpolationhigh], 5);                 photoentity = nil;                  [self.takephotobutton setimage:[uiimage imagewithdata:photodata ] forstate:uicontrolstatenormal];                   if ([self isanybuttonselected] || ![_answertextfield.text isequaltostring:@""] || !_questionboolean.hidden) {                     [tools enablecontrol:_savebutton];                 }               } else {                 newphotodata = uiimagejpegrepresentation([capturedimage resizedimage:scalesize interpolationquality:kcginterpolationhigh], 5);                 photoentity = nil;             }         }     } 

and here tried messing parent views , controllers in method. able app return central view controller minus current view controller in charge of taking photos. problem app's touch disabled , missing 1 view.

- (void) imagepickercontrollerdidcancel: (uiimagepickercontroller *) picker { //   [self willmovetoparentviewcontroller:nil]; //    [picker.view removefromsuperview]; //   [picker removefromparentviewcontroller];     [self dismissviewcontrolleranimated:yes completion:nil];  } 

i going post photos unable because new stack overflow. appreciated. thanks!

ok app not using story boards using xib files. inherited code , app created several years ago. there multiple view controllers multiple views. there central view controller other view controllers added central view.

[self.view addsubview:_catviewcontroller.tableview]; [self.view addsubview:_listviewcontroller.tableview]; [self.view addsubview:_queryviewcontroller.view]; [self.view bringsubviewtofront:_queryviewcontroller.view]; 

queryviewcontroller taking photo. when dismiss every view gone except query view controller happens take entire screen (it did not). let me know if need add more information! thanks

so, general problem central view controller adding views of other view controllers itself. can't -- breaks view controller encapsulation. , when violate encapsulation, stuff breaks. (that's vague statement, 100% true :-p) unfortunately, either need stab in dark find hack make work, or repartition problem respect encapsulation. latter better if you'll need maintain code in future.


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -