2

I'm struggling with migrating my App to iOS 11. For reusability I split my hierarchy into multiple StoryBoards. In the first StoryBoard I have a custom container view controller which hosts a tab bar and a special view (MonitoringView). It is embedded in a UINavigationController. I embed this controller in a navigation controller because I want the same functionality and title on all tabs.

enter image description here

In one of the tabs I want to display a map. On the StoryBoard I pinned the map to the SuperView with 0 so I get it under the navigation and tab bar. Here I also have a custom control which I pinned to the SafeArea of the view controller.

enter image description here

Now when I run the app, i use

if #available(iOS 11.0, *) {
    controller.additionalSafeAreaInsets = UIEdgeInsetsMake(monitoringView.frame.size.height, 0, tabBar.frame.size.height, 0)
}

in the container controller to adjust the safe area insets of the child controller (the one with the map).

While this works fine for the extra control which I pinned to the safe area, the compass and legal notice of the map are hidden under the navigation/tabbar on iOS 11. On iOS 10 though the control is under the bar while the notice and compass are to far to the center of the view

enter image description here

I am looking for a solution for days now and I tried so many different things. I'm really desperate and have no clue what I am doing wrong. Any hint is highly appreciated.

xxtesaxx
  • 6,175
  • 2
  • 31
  • 50

2 Answers2

0

try to set automaticallyAdjustsContentInset to YES or NO.

DàChún
  • 4,751
  • 1
  • 36
  • 39
-1

I think you can easily rewrite from Objective-C to Swift.

if ([[[UIDevice currentDevice] systemVersion] floatValue] >= 11)
{
    MKCompassButton *Compass = [MKCompassButton compassButtonWithMapView:self.mapView];
    Compass.frame = CGRectMake(ScreenW - 45, 90, Compass.frame.size.width, Compass.frame.size.height);
    //Compass.compassVisibility = MKFeatureVisibilityVisible;
    [self.view addSubview:Compass];
    self.mapView.showsCompass = NO;

}

User123456
  • 19
  • 2