c# - Something is overriding my constraints -
i have view load nib, add superview, , add constraints. bounds turn out wrong, , when @ view "debug view hierarchy", shows other constraints being active instead of mine. can't figure out came , why they're overriding ones set.
xcode shows this:
they grayed-out constraints own, either nib or added @ runtime. top 4 mystery ones.
the code in c# it's pretty straightforward:
var notificationview = uinib.fromname("notificationview", null) .instantiate(null, null).oftype<notificationview>().firstordefault(); var constraints = new[] { notificationview.widthanchor.constraintequalto(window.widthanchor, 0.5f, 0), notificationview.centerxanchor.constraintequalto(window.centerxanchor), notificationview.heightanchor.constraintequalto(overlayheight), notificationview.topanchor.constraintequalto(window.topanchor, -overlayheight), }; window.addsubview(notificationview); nslayoutconstraint.activateconstraints(constraints);
the view i'm adding main window; don't know if matters or not.
(i'm trying start negative top because it's supposed animate in off-screen, that's not working because of issue)
where constraints coming from, , how rid of/override them?
when adding constraints manually view, want remove constraints created autoresizing mask.
to so, add:
notificationview.translatesautoresizingmaskintoconstraints = false;
after
window.addsubview(notificationview);
Comments
Post a Comment