Skip to content
This repository has been archived by the owner on Aug 8, 2023. It is now read-only.

[ios] update layout after device has been rotated #7004

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions platform/ios/src/MGLMapView.mm
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,11 @@ - (void)commonInit
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(wakeGL:) name:UIApplicationWillEnterForegroundNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(wakeGL:) name:UIApplicationDidBecomeActiveNotification object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(didReceiveMemoryWarning) name:UIApplicationDidReceiveMemoryWarningNotification object:nil];

#if !TARGET_OS_TVOS
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We support tvOS?

[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(deviceOrientationDidChange:) name:UIDeviceOrientationDidChangeNotification object:nil];
[[UIDevice currentDevice] beginGeneratingDeviceOrientationNotifications];
#endif

// set initial position
//
Expand Down Expand Up @@ -639,6 +644,9 @@ - (void)reachabilityChanged:(NSNotification *)notification

- (void)dealloc
{
#if !TARGET_OS_TVOS
[[UIDevice currentDevice] endGeneratingDeviceOrientationNotifications];
#endif
[[NSNotificationCenter defaultCenter] removeObserver:self];
[_attributionButton removeObserver:self forKeyPath:@"hidden"];

Expand Down Expand Up @@ -1064,6 +1072,11 @@ - (void)didMoveToSuperview
[super didMoveToSuperview];
}

- (void)deviceOrientationDidChange:(__unused NSNotification *)notification
{
[self setNeedsLayout];
}

- (void)sleepGL:(__unused NSNotification *)notification
{
MGLAssertIsMainThread();
Expand Down