8
ฉันจะเปลี่ยนลำดับความสำคัญของข้อ จำกัด ในเวลาทำงานได้อย่างไร
ฉันมีมุมมองที่มีความสูงแบบไดนามิกและฉันกำลังพยายามเปลี่ยนลำดับความสำคัญของมุมมองนี้ในเวลาทำงาน นี่คือส่วนหนึ่งของรหัสของฉัน if (index == 0) { surveyViewHeightConstraint.constant = 0; surveyViewHeightConstraint.priority = 1000; } else if (index == 1) { surveyViewHeightConstraint.constant = 163; surveyViewHeightConstraint.priority = 500; } ฉันกำลังเปลี่ยนดัชนีด้วยการทำงานของปุ่ม เมื่อฉันเรียกใช้รหัสนี้ฉันได้รับข้อผิดพลาดนี้: *** Assertion failure in -[NSLayoutConstraint setPriority:], /SourceCache/Foundation/Foundation-1141.1/Layout.subproj/NSLayoutConstraint.m:174 ความผิดพลาดของฉันที่นี่คืออะไร?