ios - My layout constraints are being overridden -
i'm trying display table view overlaid on top of view show list of auto-complete options, i'm having trouble getting table view sized correctly.
i have simple uitableview defined in xib file. load it, embed in existing on-screen view, , programmatically set layout constraints leading, trailing, top, , height anchors in view controller method (code in c#):
public void embedin(uiview outerview) { outerview.addsubview(view); var constraints = new[] { view.leadinganchor.constraintequalto(outerview.leadinganchor, 8), view.trailinganchor.constraintequalto(outerview.trailinganchor, 8), view.topanchor.constraintequalto(outerview.topanchor, 15), view.heightanchor.constraintequalto(outerview.heightanchor, 0.4f, 0), }; nslayoutconstraint.activateconstraints(constraints); }
the result table view small - has same dimensions had in xib (except, weirdly, row dividers continue past bottom down bottom should be).
when examine view hierarchy in xcode, table view's constraints looks this:
the 4 constraints active ones did not add, either @ runtime or in xib. width , height in match size of table view in xib. leading, trailing, top, , height constraints there, , among other disabled constraints set matching xib dimensions, except time midx , midy instead of minx , miny.
i tried removing of table view's constraints in viewdidload
(before adding own), ones i'm trying rid of don't seem exist @ point.
so constraints coming from, , how rid of them?
tableview.translatesautoresizingmaskintoconstraints = false
Comments
Post a Comment