ios - Tableview showing the wrong size of cell -


in table setting height cell using(heightforrowatindexpath)delegate of table view code is:

  -(cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath { return  100; } 

but checking size of cell in delegate method(cellforrowatindexpath) , code is:

 - (uitableviewcell *)tableview:(uitableview *)atableview cellforrowatindexpath:(nsindexpath *)indexpath { // dequeue or create cell uitableviewcellstyle style =  uitableviewcellstyledefault; uitableviewcell *cell = [atableview dequeuereusablecellwithidentifier:@"basecell"]; if (!cell)      cell = [[uitableviewcell alloc] initwithstyle:style reuseidentifier:@"basecell"] ;  cell.textlabel.text = [nsstring stringwithformat:@"cell %d", numberofitems - indexpath.row];     nslog(@"%f",cell.frame.size.height);  return cell;   } 

when printing value(frame of cell)cell on console giving me 44.00.why happening setting height of cell..please explain me , cell oh height 100..thanks in advance

actually want make custom type table view support difrrent orientation of view , universal app better call cell size in behalf of checking every time (iphone/ipad,diff orintation)....plz me accomplish requirement

if cell being shown correctly, , correctly mean height of 100 pixels have written in tableview:heightforrowatindexpath:, i'm pretty sure it's because you're asking cell's height in wrong place: cell has been init'd default init method, height returned therefore default one, of 44 pixels nslog prompts in console, on rendering delegate sets right height returned method , set correctly.

i had issue months ago, reasons needed know cell's height in tableview:cellforrowatindexpath: method, came out workaround that: i've stored rowheights values in nsarray, since dynamic , different row row according content.

i came out like

cgfloat height = [[heightsdata objectatindex: indexpath.section] objectatindex: indexpath.row];


Comments

Popular posts from this blog

html - How to style widget with post count different than without post count -

How to remove text and logo OR add Overflow on Android ActionBar using AppCompat on API 8? -

javascript - storing input from prompt in array and displaying the array -