ios - Size Class Customization in UITableViewCell -
i have height constraint in uiimageview contained in uitableviewcell, , want 180 iphone , 300 ipad.
but doesn't make effect ipad.
it table view automatic dimension.
- (void)configuretableview { self.tableview.allowsselection = no; self.tableview.estimatedrowheight = 30.f; self.tableview.rowheight = uitableviewautomaticdimension; }
how can customize cell's height ipad?
update: fixed implementing delegate method:
- (cgfloat)tableview:(uitableview *)tableview heightforrowatindexpath:(nsindexpath *)indexpath { cgfloat height = -1; if (indexpath.section == kquizcontrollersection_description && indexpath.row == kdescriptionquizcell_previewimage) { if (ui_user_interface_idiom() == uiuserinterfaceidiompad) { height = 400; } else { height = 180; } } return height; }
because other cells resized dynamically (cells multiline labels) method returns negative number every other cell. correct approach?
i there uiimageview same height cell ....then pinned edges of uiimageview , there not need of height constraint of uiimageview...
you need set height of cell according device in heightforrowatindexpath
method
func tableview(tableview: uitableview, heightforrowatindexpath indexpath: nsindexpath) -> cgfloat { if uidevice.currentdevice().userinterfaceidiom == .pad{ return 300 } else{ return 180 } }
the other scenario uiimageview not same height cell....then make 1 iboutlet of height constraint of uiimageview , change constant per requirement...
if uidevice.currentdevice().userinterfaceidiom == .pad{ heightconstraint.constant = 300 } else{ heightconstraint.constant = 180 }
Comments
Post a Comment