幾個小時我一直在試圖弄清楚爲什麼autolayout在iOS8中突破我的約束,而在我應用CGAffineTransformMakeScale時卻沒有在iOS7中實現。 (我使用Xcode 6.0.1(6A317)與Storyboard和Autolayout)。AutoLayout CGAffineTransform iOS7 iOS8
的代碼:
TCTGridController *gridController = self.gridController;
stackController.view.frame = gridController.view.frame;
stackController.stackCollectionView.transform = CGAffineTransformMakeScale(0.1, 0.1);
[gridController.view.superview addSubview:stackController.view];
[UIView animateWithDuration:0.2 animations:^{
stackController.stackCollectionView.transform = CGAffineTransformMakeScale(1, 1);
[stackController.stackCollectionView layoutIfNeeded];
} completion:^(BOOL finished) {
[stackController didMoveToParentViewController:self];
}];
iOS7結果:
iOS8上結果:
iOS8上約束錯誤:
(
"<NSLayoutConstraint:0x7fa126a9b100 V:[_UILayoutGuide:0x7fa126a9a900]-(120)-[TCTCollectionView:0x7fa125139400]>",
"<_UILayoutSupportConstraint:0x7fa126a8b500 V:[_UILayoutGuide:0x7fa126a9a900(0)]>",
"<_UILayoutSupportConstraint:0x7fa126a8a960 V:|-(0)-[_UILayoutGuide:0x7fa126a9a900] (Names: '|':UIView:0x7fa126a9a810)>",
"<NSAutoresizingMaskLayoutConstraint:0x7fa126c86840 h=--- v=--- 'UIView-Encapsulated-Layout-Top' V:[UIView:0x7fa126a9a810]-(0)-|>"
)
任何想法?
奧洛克
非常感謝你 - 我生命的浪費小時; d'[子視圖layoutIfNeeded]'做的工作。 – mklb 2015-04-11 22:05:50