Wednesday, 15 January 2014

objective c - How to get a UITableView bigger in iOS -



objective c - How to get a UITableView bigger in iOS -

currently subclassing uitableviewcontroller. have made each cell in uitableviewcontroller bigger implementing 2 methods.

code:

(cgfloat) tableview:(uitableview *)tableview estimatedheightforrowatindexpath:(nsindexpath *)indexpath { cgfloat screenheight = [[uiscreen mainscreen] bounds].size.height; homecoming screenheight * 1/2; } (cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath { cgfloat screenheight = [[uiscreen mainscreen] bounds].size.height; homecoming screenheight * 1/2; }

i have 2 problems/ questions

my table seems pushed right , how can prepare this?

is right way to create uitableviewcontrollers cell bigger? also: if create custom cell, cant set custom cell in place of 1 entire cell , wouldn't matter height of cell is? since, beingness replaced custom cell?

any advice help. thanks.

if want every row same height no implement 2 methods have. instead, add together next line in viewwillappear::

self.tableview.rowheight = self.tableview.bounds.size.height / 2.0;

also note height based on table view's height, not screen height. ensures 2 cells fit within visible portion of table view.

only implement heightforrowatindexpath: if there rows different heights.

fyi - none of code posted has impact on table seeming pushed right. must caused else.

another note - maintain in mind [uiscreen mainscreen].bounds give wrong results under ios 7 or before if device in landscape orientation.

ios objective-c uitableview

No comments:

Post a Comment