Monday 15 March 2010

ios - How to Zoom CollectionviewCell Image when it was Selected? -



ios - How to Zoom CollectionviewCell Image when it was Selected? -

i create application conatin uicollectionview custumcell , each cell contain images want create when image selected zoom in view , when zoom view touch collectionview shown urbmediafocusviewcontroller libraray

link of library here urbmediafocusviewcontroller

i know asked many times please give me solution.

it's not elegant, how it. frame location , size of source uicollectionview cell, frame , location of want appear (in case fill view), animate between 2 sizes. hope helps.

- (void)collectionview:(uicollectionview *)collectionview didselectitematindexpath:(nsindexpath *)indexpath { [collectionview selectitematindexpath:indexpath animated:yes scrollposition:uicollectionviewscrollpositioncenteredhorizontally]; [self zoomtoselectedimage:indexpath]; } -(void)zoomtoselectedimage:(nsindexpath *)indexpath { uiimageview *zoomimage = [[uiimageview alloc] initwithimage:[self.mypictures objectatindex:indexpath.row]]; zoomimage.contentmode = uiviewcontentmodescaleaspectfit; cgrect zoomframeto = cgrectmake(0,0, self.view.frame.size.width,self.view.frame.size.height); uicollectionview *cv = (uicollectionview *)[self.view viewwithtag:66]; // alter whatever tag value of collectionview cv.hidden = true; uicollectionviewcell *celltozoom =(uicollectionviewcell *)[cv cellforitematindexpath:indexpath]; cgrect zoomframefrom = celltozoom.frame; [self.view addsubview:zoomimage]; zoomimage.frame = zoomframefrom; zoomimage.alpha = 0.2; [uiview animatewithduration:0.2 animations: ^{ zoomimage.frame = zoomframeto; zoomimage.alpha = 1; } completion:nil];

ios uicollectionview

No comments:

Post a Comment