mirror of
https://github.com/Swiftgram/Telegram-iOS.git
synced 2025-12-22 22:25:57 +00:00
Fix Modal presented ASViewController don't rotate on iOS 8.3
This commit is contained in:
@@ -89,6 +89,20 @@
|
||||
{
|
||||
[super viewWillLayoutSubviews];
|
||||
[_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
|
||||
@@ -177,8 +191,20 @@ ASVisibilityDepthImplementation;
|
||||
|
||||
- (ASSizeRange)nodeConstrainedSize
|
||||
{
|
||||
if (AS_AT_LEAST_IOS9) {
|
||||
CGSize viewSize = self.view.bounds.size;
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user