ios - UICollectionView-make a specific cell to be wider? -


using collection view scroll vertically,we have 2 columns , each row has 2 cells. make specific cell take whole row place, row have 1 cell in ,in width of screen .

problem is, when that, works, have push other cells next position, cell 4 take full width:

0 1 2 3 4-- 5 6 

how can push cells forward/ effect in more convenient way ?

 -(uicollectionviewcell *)collectionview:(uicollectionview *)collectionview cellforitematindexpath:(nsindexpath *)indexpath {   if(indexpath.item ==4)         cell.frame=cgrectmake(cell.frame.origin.x, cell.frame.origin.y, [uiscreen mainscreen].bounds.size.width, cell.frame.size.height); 

i can change data source,but seems wrong,specially if many times .

- (cgsize)collectionview:(uicollectionview *)collectionview                   layout:(uicollectionviewlayout*)collectionviewlayout   sizeforitematindexpath:(nsindexpath *)indexpath {       if(indexpath.row==4)      return cgsizemake([uiscreen mainscreen].bounds.size.width, 0.36*[uiscreen mainscreen].bounds.size.height);     else         return cgsizemake(0.4*[uiscreen mainscreen].bounds.size.width, 0.36*[uiscreen mainscreen].bounds.size.height);  } 

Comments

Popular posts from this blog

javascript - Jquery show_hide, what to add in order to make the page scroll to the bottom of the hidden field once button is clicked -

javascript - Highcharts multi-color line -

javascript - Enter key does not work in search box -