需要注意的是,只能修改可选约束的优先级,也就是说:
- 不允许将优先级由小于1000的值改为1000
- 不允许将优先级由1000修改为小于1000的值
例如,如果将优先级由250修改为1000,则会抛出异常:
*** Terminating app due to uncaught exception 'NSInternalInconsistencyException', reason: 'Mutating a priority from required to not on an installed constraint (or vice-versa) is not supported. You passed priority 1000 and the existing priority was 250.'