ios - Detect Final Layout Size for View with Flexible Width in UITableViewCell -
i using size classes in ios 8-only app , have view inside uitableviewcell
has flexible width. auto layout constraints defined follows:
as can see, width varies depending on device width/orientation.
when print frame in cellforrowatindexpath
see (180.0, 10.0, 400.0, 60.0) shows 400 width. when measure view in simulator, 175 wide, reinforced fact view's content truncated (i'm drawing stuff inside it).
how can know when uitableviewcell
's contraints , subviews done rendering can redraw stuff inside view?
update
in cellforrowatindexpath
i'm doing following cell:
let cell = tableview.dequeuereusablecellwithidentifier("timetypecell", forindexpath: indexpath) as! timetypecell let customfield = customfields[indexpath.row] cell.fieldnamelabel.text = customfield["name"] as? string cell.fieldvaluelabel.text = customfield["total"] as? string cell.graphdata = customfield["totalgraph"] as! [double] cell.fieldgraph.datasource = cell.self cell.fieldgraph.delegate = cell.self cell.fieldgraph.reloaddata() //this redrawing happens
call cell.contentview.layoutifneeded()
content views laid out correctly. while cell should correct size when returned tableview.dequeuereusablecellwithidentifier(_, forindexpath:)
, seems content view doesn't run layout, need call manually if need date @ point.
Comments
Post a Comment