2015-11-27 4 views
0

Привет, проблема в том, что UILabel не отображает весь текст между двумя версиями Xcode, и я помещал сером цветной кадр, чтобы показать лучше.Xcode 6.4 и Xcode 7.0 Несоответствия NSLayoutConstraint

Это де-код:

_descriptionLabel.numberOfLines = 0; 
    [_descriptionLabel setLineBreakMode:NSLineBreakByWordWrapping]; 
    _descriptionLabel.adjustsFontSizeToFitWidth = NO; 
    [_descriptionLabel sizeToFit]; 

NSLayoutConstraint *descriptionTop = [NSLayoutConstraint constraintWithItem:self.descriptionLabel 
                    attribute:NSLayoutAttributeTop 
                    relatedBy:NSLayoutRelationEqual 
                    toItem:self.categoryLabel 
                    attribute:NSLayoutAttributeBottom 
                   multiplier:1 
                    constant:0]; 


NSLayoutConstraint *descriptionLeading = [NSLayoutConstraint constraintWithItem:self.descriptionLabel 
                     attribute:NSLayoutAttributeLeading 
                     relatedBy:NSLayoutRelationEqual 
                     toItem:self.segmentedControl 
                     attribute:NSLayoutAttributeLeading 
                    multiplier:1 
                     constant:0]; 

NSLayoutConstraint *descriptionTrailing = [NSLayoutConstraint constraintWithItem:self.descriptionLabel 
                     attribute:NSLayoutAttributeTrailing 
                     relatedBy:NSLayoutRelationEqual 
                      toItem:self.segmentedControl 
                     attribute:NSLayoutAttributeTrailing 
                     multiplier:1 
                     constant:0]; 

NSLayoutConstraint *descriptionBottom = [NSLayoutConstraint constraintWithItem:self.descriptionLabel 
                    attribute:NSLayoutAttributeBottom 
                    relatedBy:NSLayoutRelationEqual 
                     toItem:self.containerView 
                    attribute:NSLayoutAttributeBottom 
                    multiplier:1 
                     constant:0]; 



[self addConstraints:@[descriptionTop,descriptionLeading,descriptionTrailing,descriptionBottom]]; 

И этот образ из Xcode 6.4 и показать весь текст ОК

enter image description here

И этот образ из Xcode 7,0 текста шоу вырезать

enter image description here

Любые комментарии оцениваются

+0

Это вряд ли будет компилятором. Оба изображения из одной версии iOS? – Paulw11

+0

Различные Xcodes, но они также разные _systems_? Это важная вещь. – matt

+0

Что такое 'self'? И где все это происходит? Где упоминаются другие интерфейсные объекты? Я не вижу их в ваших снимках экрана? Используется ли ячейка таблицы? Дайте _информацию, если вам нужна помощь. – matt

ответ

0

Посмотрите на отладчик, предупреждающий о нарушении противоречивых ограничений.

Либо ваш ярлык получил свой autoResizingMask, преобразованный в ограничения, и они конфликтуют с этими четырьмя ограничениями выше, или те 4 конфликтуют с вашими существующими ограничениями в этом «своем».

Смежные вопросы