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:

enter image description here

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

Popular posts from this blog

ios - MKAnnotationView layer is not of expected type: MKLayer -

ZeroMQ on Windows, with Qt Creator -

unity3d - Unity SceneManager.LoadScene quits application -