[英]iOS8 Autolayout Rotation with iPad does not seem to correctly re-size collectionView
I have a collection view added as a subview to self.view
and autolayout constraints are just stretch to edges. 我已经加入作为一个子视图到集合视图
self.view
和自动布局约束只是延伸到边缘。
I'm trying to achieve a solution where the rotation properly re-sizes the contents of the collection view. 我正在尝试找到一种解决方案,其中旋转可正确调整集合视图内容的大小。
Landscape 景观
And then if you rotate to portrait 然后如果旋转到纵向
How can I achieve this? 我该如何实现?
The strange thing is if I present a viewcontroller
modally and dismiss it, the underlying collectionView
will get resized on dismissal. 奇怪的是,如果我模态地提供一个
viewcontroller
控制器并将其关闭,则底层的collectionView
会在关闭时调整大小。
This will help to resize the contents on rotation ` - (void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id)coordinator { 这将有助于调整旋转内容的大小--(void)viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:{id)coordinator {
[coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext> context) {
[self.collectionView performBatchUpdates:nil completion:nil];
} completion:nil];
}` }`
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.