ios - Add Arrays of (parse.com) to a UICollectionView SubView -
i trying add label (string array) parse.com subview shows after tapping image inside uicollectionviewcell.
the subview appears, , text it's same text in every subview of each cell. not changing.. arrays in databrowser are: precio_0, precio_1, precio_2 etc..
what doing wrong? how code go recognize cell. if set code in uicollectionviewcell , not in subview there no problem, text changes in every view. i'm missing don't know is.
**note: detailview , data being passed property data method goes: [self.vestimenta objectforkey:@"string"]
my code:
-(uicollectionviewcell *)collectionview:(uicollectionview *)collectionview cellforitematindexpath:(nsindexpath *)indexpath { static nsstring *cellidentifier = @"cell"; vestimentadetailcell *cell = (vestimentadetailcell *) [collectionview dequeuereusablecellwithreuseidentifier:cellidentifier forindexpath:indexpath]; [cell.activityindicator startanimating]; cell.imagefile.image = [uiimage imagenamed:@"loadlook.png"]; pffile *imagefile = [self.vestimenta objectforkey:[nsstring stringwithformat:@"image_%ld", (long)indexpath.row]]; [imagefile getdatainbackgroundwithblock:^(nsdata *data, nserror *error) { if (!error && data.length > 0) { cell.imagefile.image = [uiimage imagewithdata:data]; uitapgesturerecognizer *infolook = [[uitapgesturerecognizer alloc]initwithtarget:self action:@selector(handletap:)]; infolook.numberoftapsrequired = 1; [cell.imagefile addgesturerecognizer:infolook]; } else { [cell.progressview removefromsuperview]; } } progressblock:^(int percentdone) { float percent = percentdone * 0.02; [cell.progressview setprogress:percent]; if (percentdone == 100){ [cell.progressview removefromsuperview]; }; [cell.showinfo addtarget:self action:@selector(handletap:) forcontrolevents:uicontroleventtouchupinside]; [cell.activityindicator stopanimating]; }]; return cell; } -(void)handletap:(uitapgesturerecognizer *) infolook{ cgrect frame = cgrectmake(0, 0, 320, 519); uiview *infoview = [[uiview alloc] initwithframe:frame]; infoview.opaque = no; infoview.backgroundcolor = [[uicolor blackcolor] colorwithalphacomponent:0.8f]; infoview.userinteractionenabled = yes; infoview.tag = 01; uibutton *pricetag = [[uibutton alloc] initwithframe:cgrectmake(282, 370, 25, 25)]; [pricetag setimage:[uiimage imagenamed:@"price.png"] forstate:uicontrolstatenormal]; uilabel *precioproductos = [[uilabel alloc] initwithframe:cgrectmake(32, 370, 240, 190)]; precioproductos.textcolor = [uicolor whitecolor]; precioproductos.backgroundcolor = [uicolor clearcolor]; precioproductos.textalignment = nstextalignmentright; precioproductos.numberoflines = 0; precioproductos.font = [uifont fontwithname:@"helveticaneue-lightitalic" size:15];
this part shows calling of arrays in parse.com:
vestimentadetailcell *price = (vestimentadetailcell *)[precioproductos superview]; nsindexpath *indexpath = [imagescollection indexpathforcell:price]; nsmutablestring *precio = [nsmutablestring string]; (nsstring* precios in [self.vestimenta objectforkey:[nsstring stringwithformat:@"precios_%ld", (long)indexpath.row]]) { [precio appendformat:@"%@\n", precios]; } precioproductos.text = precio; [precioproductos sizetofit]; cgrect myframe = precioproductos.frame; myframe = cgrectmake(myframe.origin.x, myframe.origin.y, 240, myframe.size.height); precioproductos.frame = myframe; [infoview addsubview:pricetag]; [infoview addsubview:precioproductos]; [self.view addsubview:infoview]; uitapgesturerecognizer *dismissview = [[uitapgesturerecognizer alloc]initwithtarget:self action:@selector(processtap:)]; dismissview.numberoftapsrequired = 1; [infoview addgesturerecognizer:dismissview]; }
Comments
Post a Comment