UIScrollView doesn’t use autolayout constraints

The relationship between UIScrollView and auto layout is different from other aspects of auto layout. Basically, if simple auto layout were allowed to operate, nothing would scroll. For example, if a subview of the scroll view were pinned in the normal way by a constraint to 10 points from the top of the scroll view, … Read more

C# Generics won’t allow Delegate Type Constraints

A number of classes are unavailable as generic contraints – Enum being another. For delegates, the closest you can get is “: class”, perhaps using reflection to check (for example, in the static constructor) that the T is a delegate: static GenericCollection() { if (!typeof(T).IsSubclassOf(typeof(Delegate))) { throw new InvalidOperationException(typeof(T).Name + ” is not a delegate … Read more

Template Constraints C++

If you use C++11, you can use static_assert with std::is_base_of for this purpose. For example, #include <type_traits> template<typename T> class YourClass { YourClass() { // Compile-time check static_assert(std::is_base_of<BaseClass, T>::value, “type parameter of this class must derive from BaseClass”); // … } }

How can I drop a “not null” constraint in Oracle when I don’t know the name of the constraint?

alter table MYTABLE modify (MYCOLUMN null); In Oracle, not null constraints are created automatically when not null is specified for a column. Likewise, they are dropped automatically when the column is changed to allow nulls. Clarifying the revised question: This solution only applies to constraints created for “not null” columns. If you specify “Primary Key” … Read more

How can I change constraints priority in run time

As stated in NSLayoutConstraint class reference: Priorities may not change from nonrequired to required, or from required to nonrequired. An exception will be thrown if a priority of NSLayoutPriorityRequired in OS X or UILayoutPriorityRequired in iOS is changed to a lower priority, or if a lower priority is changed to a required priority after the … Read more