Problem z ograniczeniami układu na iOS7 w UITableViewCell
Korzystam programowo z ograniczeń układu automatycznego, aby rozmieścić moje niestandardowe komórki UITableView i poprawnie definiuję rozmiary komórek wtableView:heightForRowAtIndexPath:
Działa dobrze na iOS6 i tak jestPopatrz dobrze w iOS7
ALE kiedy uruchomię aplikację na iOS7, oto rodzaj wiadomości, którą widzę w konsoli:
Break on objc_exception_throw to catch this in the debugger.
The methods in the UIConstraintBasedLayoutDebugging category on UIView listed in <UIKit/UIView.h> may also be helpful.
2013-10-02 09:56:44.847 Vente-Exclusive[76306:a0b] Unable to simultaneously satisfy constraints.
Probably at least one of the constraints in the following list is one you don't want. Try this: (1) look at each constraint and try to figure out which you don't expect; (2) find the code that added the unwanted constraint or constraints and fix it. (Note: If you're seeing NSAutoresizingMaskLayoutConstraints that you don't understand, refer to the documentation for the UIView property translatesAutoresizingMaskIntoConstraints)
(
"<NSLayoutConstraint:0xac4c5f0 V:|-(15)-[UIImageView:0xac47f50] (Names: '|':UITableViewCellContentView:0xd93e850 )>",
"<NSLayoutConstraint:0xac43620 V:[UIImageView:0xac47f50(62)]>",
"<NSLayoutConstraint:0xac43650 V:[UIImageView:0xac47f50]-(>=0)-[UIView:0xac4d0f0]>",
"<NSLayoutConstraint:0xac43680 V:[UIView:0xac4d0f0(1)]>",
"<NSLayoutConstraint:0xac436b0 V:[UIView:0xac4d0f0]-(0)-| (Names: '|':UITableViewCellContentView:0xd93e850 )>",
"<NSAutoresizingMaskLayoutConstraint:0xac6b120 h=--& v=--& V:[UITableViewCellContentView:0xd93e850(44)]>"
)
Will attempt to recover by breaking constraint
<NSLayoutConstraint:0xac43650 V:[UIImageView:0xac47f50]-(>=0)-[UIView:0xac4d0f0]>
Iw rzeczy samej jest jedna z ograniczeń na tej liście, której nie chcę:
"<NSAutoresizingMaskLayoutConstraint:0xac6b120 h=--& v=--& V:[UITableViewCellContentView:0xd93e850(44)]>"
i nie mogę ustawićtranslatesAutoresizingMaskIntoConstraints
własnośćcontentView
na NIE => to zepsułoby całą komórkę.
44 to domyślna wysokość komórki, ale zdefiniowałem moje niestandardowe wysokości w pełnomocniku widoku tabeli, więc dlaczego treść contentView ma to ograniczenie? Co może to spowodować?
W iOS6 tak się nie dzieje i wszystko wygląda dobrze na iOS6 i iOS7.
Mój kod jest dość duży, więc nie będę go tutaj publikował, ale jeśli potrzebujesz, możesz poprosić o pastebin.
Aby określić, w jaki sposób to robię, na intializacji komórek:
Tworzę wszystkie moje etykiety, przyciski itpUstawiam ichtranslatesAutoresizingMaskIntoConstraints
własność NIEDodaję je jako podpowiedzicontentView
komórkiDodaję ograniczenia docontentView
Jestem również głęboko zainteresowany zrozumieniem, dlaczego tak się dzieje tylko na iOS7.