ios - capture image is not working properly.? -
hi new developing ios application please me. facing problem regarding capturing image using uiimagepicker. have integrated hip mob app in our application.
in window want show uibutton user click on uibutton should capture image. when click on button throwing message (whose view not in window hierarchy!).
i think happens due chat window. here code snippet.!
[[hmservice sharedservice] openchat:self withsetup:^(hmchatviewcontroller * controller) { controller.chatdelegate = self; controller.chatview.receivedmessagefont = [uifont systemfontofsize:20.0]; controller.navigationbarhidden = yes; uiview * viewobjforvehicledetails = [[uiview alloc]init]; uibutton * btnforcaputrephoto = [[uibutton alloc]init]; [btnforcaputrephoto addtarget:self action:@selector(capturephotoimage) forcontrolevents:uicontroleventtouchupinside]; btnforcaputrephoto.frame = cgrectmake(55, 90, 103, 85); [controller.chatview addsubview:viewobjforvehicledetails]; [viewobjforvehicledetails addsubview:btnforcaputrephoto]; [[controller.chatview table] registerclass:[chattableviewcell class] forcellreuseidentifier:@"reusechattableviewcell"]; } -(void)capturephotoimage { uiimagepickercontroller *picker = [[uiimagepickercontroller alloc] init]; picker.delegate = self; picker.allowsediting = yes; picker.sourcetype = uiimagepickercontrollersourcetypecamera; [self presentviewcontroller:picker animated:no completion:nil]; } - (void)imagepickercontroller:(uiimagepickercontroller *)picker didfinishpickingmediawithinfo:(nsdictionary *)info { [picker dismissviewcontrolleranimated:yes completion:null]; } thanks in advance.!
first sure using following delegate in view controller
<uinavigationcontrollerdelegate, uiimagepickercontrollerdelegate> secondly use line show imagepicker:-
[self presentmodalviewcontroller:picker animated:yes]; alternative way:-
[self.view addsubview:imagepicker.cameraoverlayview]
Comments
Post a Comment