Fix Modal presented ASViewController don't rotate on iOS 8.3

This commit is contained in:
Michael Schneider
2016-06-24 20:59:07 -07:00
parent b1626b0f69
commit 057c48482a

View File

@@ -89,6 +89,20 @@
{ {
[super viewWillLayoutSubviews]; [super viewWillLayoutSubviews];
[_node measureWithSizeRange:[self nodeConstrainedSize]]; [_node measureWithSizeRange:[self nodeConstrainedSize]];
if (!AS_AT_LEAST_IOS9) {
[self _legacyHandleViewDidLayoutSubviews];
}
}
- (void)_legacyHandleViewDidLayoutSubviews
{
// In modal presentation the view does not automatic resize in iOS7 and iOS8. As workaround we adjust the frame of the
// view manually
if (self.presentingViewController != nil) {
CGSize maxConstrainedSize = [self nodeConstrainedSize].max;
_node.frame = (CGRect){.origin = CGPointZero, .size = maxConstrainedSize};
}
} }
- (void)viewDidLayoutSubviews - (void)viewDidLayoutSubviews
@@ -177,8 +191,20 @@ ASVisibilityDepthImplementation;
- (ASSizeRange)nodeConstrainedSize - (ASSizeRange)nodeConstrainedSize
{ {
if (AS_AT_LEAST_IOS9) {
CGSize viewSize = self.view.bounds.size; CGSize viewSize = self.view.bounds.size;
return ASSizeRangeMake(viewSize, viewSize); return ASSizeRangeMake(viewSize, viewSize);
} else {
return [self _legacyConstrainedSize];
}
}
- (ASSizeRange)_legacyConstrainedSize
{
// In modal presentation the view does not have the right bounds in iOS7 and iOS8. As workaround using the superviews
// view bounds
CGSize viewSize = (self.presentingViewController != nil) ? self.view.superview.bounds.size : self.view.bounds.size;
return ASSizeRangeMake(viewSize, viewSize);
} }
- (ASInterfaceState)interfaceState - (ASInterfaceState)interfaceState