ios - Autolayout For Subviews of UITableViewCell not works well -


in uitabelviewcell ,there problem when add uiview , uilabel.
uilabel has dynamic height, , uiview has fixed rect, think. first of all, translatesautoresizingmaskintoconstraints = no both of them, , label's preferredmaxlayoutwidth = 280, , numberoflines = 0.

constraints ,as follows:

nsdictionary *views = @{@"_label":self.label,@"_view":self.view};  [self.contentview addconstraints:[nslayoutconstraint constraintswithvisualformat:@"|-[_label]-|"                                                                   options:0                                                                   metrics:nil                                                                     views:views]]; [self.contentview addconstraints:[nslayoutconstraint constraintswithvisualformat:@"|-[_view]-|"                                                                   options:0                                                                   metrics:nil                                                                     views:views]]; [self.contentview addconstraints:[nslayoutconstraint constraintswithvisualformat:@"v:|-[_label(100@300)]-[_view(20)]-|"                                                                   options:0                                                                   metrics:nil                                                                     views:views]]; 

when finished, label has 1 line, , there exceptions:

 (  "<nslayoutconstraint:0x8cdb450 v:|-(nsspace(20))-[uilabel:0x8cda6e0]   (names: '|':uitableviewcellcontentview:0x8cd9e40 )>", "<nslayoutconstraint:0x8cdb530 v:[uiview:0x8cda930(20)]>", "<nslayoutconstraint:0x8cdb560 v:[uiview:0x8cda930]-(nsspace(20))-|   (names: '|':uitableviewcellcontentview:0x8cd9e40 )>", "<nsautoresizingmasklayoutconstraint:0x8cdb100 h=--& v=--& v:[uitableviewcellcontentview:0x8cd9e40(44)]>", "<nslayoutconstraint:0x8a88de0 v:[uilabel:0x8cda6e0]-(nsspace(8))-[uiview:0x8cda930]>" )  attempt recover breaking constraint  <nslayoutconstraint:0x8a88de0 v:[uilabel:0x8cda6e0]-(nsspace(8))-[uiview:0x8cda930]> 


Comments

Popular posts from this blog

java - Intellij Synchronizing output directories .. -

git - Initial Commit: "fatal: could not create leading directories of ..." -