uiimageview - How can i retrieve a image from Parse.com via query at iOS? -
i using parse.com retrieving data.i want retrieve images parse via pf query approach not working.i nothing uiimageview is. here code:
pfquery *query = [pfquery querywithclassname:@"class"]; [query wherekey:@"yes or no" equalto:[nsnumber numberwithbool:yes]]; [query findobjectsinbackgroundwithblock:^(nsarray *objects, nserror *error) { if (!error) { // find succeeded. nslog(@"successfully retrieved %d scores.", objects.count); (int = 0; < objects.count; i++) { object = [objects objectatindex:i]; nsstring *property1 = [object objectforkey:@"property1"]; __block uiimage *mypicture = [[uiimage alloc]init]; pffile *imagefile = [object objectforkey:@"resimler"]; [imagefile getdatainbackgroundwithblock:^(nsdata *data, nserror *error){ if (!error) { mypicture = [uiimage imagewithdata:data]; } }]; aclass *ac = [[aclass alloc]initwithproperty:propert1 picture:mypicture]; [self.myarray addobject:ac]; } } } else { // log details of failure nslog(@"error: %@ %@", error, [error userinfo]); } }]; } - (uitableviewcell *)tableview:(uitableview *)tableview cellforrowatindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"cell"; myviewviewcell *cell = (myviewcell *)[tableview dequeuereusablecellwithidentifier:cellidentifier forindexpath:indexpath]; if (cell == nil) { nsarray *nib = [[nsbundle mainbundle] loadnibnamed:@"cell" owner:self options:nil]; cell = [nib objectatindex:0]; } aclass *mc = [self.myarray objectatindex:indexpath.row]; cell.label.text = mc.property; cell.myimage.image = mc.picture; return cell; }
edit:
at aclass.h @interface aclass : nsobject @property(strong)nsstring *property; @property(strong)uiimage *resim; -(id)initwithproperty:(nsstring *)aproperty picture:(uiimage *)apicture ; @end @ aclass.m @implementation mekan @synthesize property, picture; -(id)initwithmekanismi:(nsstring *)aproperty picture:(uiimage *)apicture{ self=[super init]; if(self){ self.property = aproperty; self.picture = apicture; } return self; } @end
i know kind of mass code have write codes illustrate assign myimage. can ask not understand
i this:
uiimageview *imageview = [[uiimageview alloc] initwithimage:@"default.png"]; [usericon getdatainbackgroundwithblock:^(nsdata *data, nserror *error) { imageview.image = [[uiimage alloc] initwithdata:data]; } progressblock:^(int percentdone) { // update progress }];
you seem assigning uiimage properly, never setting image image uiimageview.
Comments
Post a Comment