ios - uicollectionview cell frame in portrait and landscape -


i stuck in frame of uicollectionview cell frame want is,

in landscape mode of ipad want show 3 cells, , in portrait 2 cells.

when write code of frame in method - (cgsize)collectionview:(uicollectionview *)collectionview layout:(uicollectionviewlayout *)collectionviewlayout sizeforitematindexpath:(nsindexpath *)indexpath not affecting size of frame.

i checked applying debugger whether coming in method or not. coming , returning size.

by default have launch application in landscape , if required in portrait.

here how showing in landscape

enter image description here

here how cells looking in portrait

enter image description here

here code frame

- (cgsize)collectionview:(uicollectionview *)collectionview layout:(uicollectionviewlayout *)collectionviewlayout sizeforitematindexpath:(nsindexpath *)indexpath {   //return [self.cellsizes[indexpath.item] cgsizevalue];     if (uideviceorientationislandscape([[uiapplication sharedapplication] statusbarorientation]))     {         return cgsizemake(100, 100);     }     return cgsizemake(200, 200); } 

what ever value pass, frame not @ changing. didn't passed other frame value where.

i want give hardcoded value cell frame first go dynamic. i'm stuck @ first place only. can 1 please me.

thanks in advance.

i faced similiar problem should implement uicollectionviewdelegateflowlayout in view controller otherwise design custom collectionviewcell , register in view controller , work . try .

in case added xib subclassing uicollectionviewcell , designed accordingly , works may try .


Comments

Popular posts from this blog

c++ - QTextObjectInterface with Qml TextEdit (QQuickTextEdit) -

javascript - angular ng-required radio button not toggling required off in firefox 33, OK in chrome -

xcode - Swift Playground - Files are not readable -