ios - iPad displaying a selected pic from a popover -
after researching uiimagepickercontroller, got code select image popover , display in myparticularimageview.
this viewcontroller.m:
@interface viewcontroller () { uiimagepickercontroller *imagepickercontroller; uipopovercontroller *popover; } @end - (ibaction)chooseimagebuttonpressed:(id)sender { uiimagepickercontroller *imagepicker = [[uiimagepickercontroller alloc] init]; popover = [[uipopovercontroller alloc] initwithcontentviewcontroller:imagepicker]; [popover setdelegate:self]; [popover presentpopoverfromrect:((uibutton *)sender).frame inview:self.view permittedarrowdirections:uipopoverarrowdirectionany animated:yes]; } //then dismiss popover , display pic -(void) imagepickercontroller:(uiimagepickercontroller *)picker didfinishpickingmediawithinfo:(nsdictionary *)info { uiimage *image = [info objectforkey:uiimagepickercontrolleroriginalimage]; [[self myparticularimageview] setimage:image]; [popover dismisspopoveranimated:yes]; } @end
the problem have when tap on pic popover nothing happens.
in .h got:
:uiviewcontroller <uiimagepickercontrollerdelegate, uinavigationcontrollerdelegate, uipopovercontrollerdelegate>
what might cause problem , how solve it?
you not image pickers delegate, why not hitting delegate method.
need add: [imagepicker setdelegate:self];
@ point when creating it.
Comments
Post a Comment