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
here how cells looking in portrait
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
Post a Comment