uiimageview - [iOS]Choose Image from Photo Gallery -


i know how open photo gallery , want select 1 of images , place on uiimageview , there way ?

did u mention photo gallery means ?

below 1 code access image photo library

-(void)photolibraryaction {     nslog(@"image");     if(picker!=nil){         [picker dismissmodalviewcontrolleranimated:yes];         [test dismisspopoveranimated:yes];         picker.delegate=nil;         picker=nil;         test.delegate=nil;         test=nil;     }     picker= [[uiimagepickercontroller alloc] init];     picker.sourcetype = uiimagepickercontrollersourcetypesavedphotosalbum;     picker.delegate=(id)self;      nslog(@"%@",picker);     if(ui_user_interface_idiom()==uiuserinterfaceidiomphone)     {         [self  presentmodalviewcontroller:picker animated:yes];     }     // [self pre     else if(ui_user_interface_idiom()==uiuserinterfaceidiompad)     {         uipopovercontroller *popimagelibrary=[[uipopovercontroller alloc]initwithcontentviewcontroller:picker];         test=popimagelibrary;         test.delegate=(id)self;          [test presentpopoverfromrect:cgrectmake(240, 730, 400, 0) inview:self.view permittedarrowdirections:uipopoverarrowdirectiondown animated:yes];     }  } 

and set delegate image picker

picker.delegate=(id)self; 

then use delegate method

- (void)imagepickercontroller:(uiimagepickercontroller *)albumpicker didfinishpickingmediawithinfo:(nsdictionary *)info {      if(ui_user_interface_idiom()==uiuserinterfaceidiomphone || albumpicker.sourcetype==uiimagepickercontrollersourcetypecamera)         {             self.imagedata=[info objectforkey:@"uiimagepickercontrolleroriginalimage"];                 [albumpicker dismissmodalviewcontrolleranimated:yes];          }         else         {             yourimageview.image=[info objectforkey:@"uiimagepickercontrolleroriginalimage"];             [test dismisspopoveranimated:yes];                       }  } 

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 -