iOS 11 iPhone X simulator UITabBar icons and titles being rendered on top covering eachother
Asked Answered
R

32

139

Anyone having issue with the iPhone X simulator around the UITabBar component?

Mine seem to be rendering the icons and title on top of each other, I'm not sure if I'm missing anything, I also ran it in the iPhone 8 simulator, and one actual devices where it looks fine just as shown on the story board.

iPhone X:

iPhone X UITabBar bug

iPhone 8

iPhone 8 UITabBar works

Resolute answered 14/9, 2017 at 8:59 Comment(4)
My similar issue: the selection indicator image view sinks in the tabBar view about 16 points in iPhone X.Sullage
FYI - this is unfortunately not fixed in Xcode 9.2betaBloomery
This is a uikit bug that still exists. Constraints have to be set up just right. See my answer below!Histogenesis
I had issues like that Check this answer https://mcmap.net/q/168220/-how-to-correct-tab-bar-height-issue-on-iphone-xZobias
A
41

I was able to get around the problem by simply calling invalidateIntrinsicContentSize on the UITabBar in viewDidLayoutSubviews.

-(void)viewDidLayoutSubviews
{
    [super viewDidLayoutSubviews];
    [self.tabBar invalidateIntrinsicContentSize];
}

Note: The bottom of the tab bar will need to be contained to the bottom of the main view, rather than the safe area, and the tab bar should have no height constraint.

Amadou answered 27/9, 2017 at 1:54 Comment(9)
I've got a tab bar with no height constraint, constrained to the Bottom Layout Guide, and this did not work for me. Any other ideas?Randallrandan
Not working when homeVC present VC A, then dismiss A, and push VC B from homeVC. This is a workaround https://mcmap.net/q/168221/-why-page-push-animation-tabbar-moving-up-in-the-iphone-xLorsung
Adding this method combined with pinning the tab bar to the bottom of its superview (not the safe area) worked for me.Respiratory
I also needed to add [self.view layoutIfNeeded].Pfeffer
Hello I have programmatically created tab bar controller and shows on successful login in a home screen in that where do I need to write this code which you have suggestedAirlia
This worked for iOS 11.0 but it is not working for iOS 11.1 and iOS 11.2Diagenesis
This works but I learned I must also pay attention to the sizes of the images in the tab bar buttons. In landscape mode (on compact devices, but not iPad and iPhone Plus models), the system uses a compact tab bar which is supposed to have smaller images that you can set with the landscapeImage property of the tab bar button. Recommended sizes are in [Apple HIG's] (developer.apple.com/design/human-interface-guidelines/ios/…) under Custom Icon SizeHibbert
@ooops https://mcmap.net/q/166063/-ios-11-iphone-x-simulator-uitabbar-icons-and-titles-being-rendered-on-top-covering-eachother I think this will simply fix the problem.Finis
This is also better than subclassing because subclassing UITabBar breaks automatic dark mode supportApricot
W
26

Answer provided by VoidLess fixes TabBar problems only partially. It fixes layout problems within the tabbar, but if you use viewcontroller that hides the tabbar, the tabbar is rendered incorrectly during animations (to reproduce it is best 2 have 2 segues - one modal and one push. If you alternate the segues, you can see the tabbar being rendered out of place). The code bellow fixes both problems. Good job apple.

class SafeAreaFixTabBar: UITabBar {

var oldSafeAreaInsets = UIEdgeInsets.zero

@available(iOS 11.0, *)
override func safeAreaInsetsDidChange() {
    super.safeAreaInsetsDidChange()

    if oldSafeAreaInsets != safeAreaInsets {
        oldSafeAreaInsets = safeAreaInsets

        invalidateIntrinsicContentSize()
        superview?.setNeedsLayout()
        superview?.layoutSubviews()
    }
}

override func sizeThatFits(_ size: CGSize) -> CGSize {
    var size = super.sizeThatFits(size)
    if #available(iOS 11.0, *) {
        let bottomInset = safeAreaInsets.bottom
        if bottomInset > 0 && size.height < 50 && (size.height + bottomInset < 90) {
            size.height += bottomInset
        }
    }
    return size
}

override var frame: CGRect {
    get {
        return super.frame
    }
    set {
        var tmp = newValue
        if let superview = superview, tmp.maxY != 
        superview.frame.height {
            tmp.origin.y = superview.frame.height - tmp.height
        }

        super.frame = tmp
        }
    }
}

Objective-C code:

@implementation VSTabBarFix {
    UIEdgeInsets oldSafeAreaInsets;
}


- (void)awakeFromNib {
    [super awakeFromNib];

    oldSafeAreaInsets = UIEdgeInsetsZero;
}


- (void)safeAreaInsetsDidChange {
    [super safeAreaInsetsDidChange];

    if (!UIEdgeInsetsEqualToEdgeInsets(oldSafeAreaInsets, self.safeAreaInsets)) {
        [self invalidateIntrinsicContentSize];

        if (self.superview) {
            [self.superview setNeedsLayout];
            [self.superview layoutSubviews];
        }
    }
}

- (CGSize)sizeThatFits:(CGSize)size {
    size = [super sizeThatFits:size];

    if (@available(iOS 11.0, *)) {
        float bottomInset = self.safeAreaInsets.bottom;
        if (bottomInset > 0 && size.height < 50 && (size.height + bottomInset < 90)) {
            size.height += bottomInset;
        }
    }

    return size;
}


- (void)setFrame:(CGRect)frame {
    if (self.superview) {
        if (frame.origin.y + frame.size.height != self.superview.frame.size.height) {
            frame.origin.y = self.superview.frame.size.height - frame.size.height;
        }
    }
    [super setFrame:frame];
}


@end
Woven answered 10/11, 2017 at 14:57 Comment(4)
Complete solution. Thanks.Rutan
Thank you for your answer. But how do you use it in a UITabBarController class ?Fionafionna
@Jojo, given how much code is needed to populate tabbar via code, I always create uitabbarcontroller using storyboards. There you can assign custom class for tabbar. Hope this helps.Woven
this issue doesn't occur on real device I've tested this on iPhone11 pro iOS 13Sidereal
C
22

There is a trick by which we can solve the problem.

Just put your UITabBar inside a UIView.

This is really working for me.

Or you can follow this Link for more details.

Carencarena answered 24/11, 2017 at 11:11 Comment(7)
This worked fine, have a uiview that simply contains the UITabBar. Put the contraints to the safe areas on the UIView (L, R, and Bottom), give it a height (49), and constrain the UITabBar to the UIView on all sides.Belle
This solution worked for me. I was not using an UITabController, just UITabBar.Theatricals
Worked for me. ThanksAlbino
This helped me out! Thank you!Extricate
This worked for me as well. Be sure to set the views bottom constraint to the safe area bottom.Eponymous
This works but then the "unsafe" area might not be the same color as the tab bar (in case the super view and the tabbar are not of the same color)Chrismatory
This is the best solution hereTaconite
G
21

override UITabBar sizeThatFits(_) for safeArea

extension UITabBar {
    static let height: CGFloat = 49.0

    override open func sizeThatFits(_ size: CGSize) -> CGSize {
        guard let window = UIApplication.shared.keyWindow else {
            return super.sizeThatFits(size)
        }
        var sizeThatFits = super.sizeThatFits(size)
        if #available(iOS 11.0, *) {
            sizeThatFits.height = UITabBar.height + window.safeAreaInsets.bottom
        } else {
            sizeThatFits.height = UITabBar.height
        }
        return sizeThatFits
    }
}
Garment answered 15/5, 2018 at 8:52 Comment(2)
Brilliant. I have just set custom size of my tabbar and wondering why it doesn't work on iPhoneX. Other solutions doesn't work for me as I am using Tab Bar Controller and it doesn't include constraints.Stentor
Looks like this technique broke with Xcode 12 / iOS 14.Mcmillin
N
13

I added this to viewWillAppear of my custom UITabBarController, because none of the provided answers worked for me:

tabBar.invalidateIntrinsicContentSize()
tabBar.superview?.setNeedsLayout()
tabBar.superview?.layoutSubviews()
Natascha answered 8/5, 2018 at 12:2 Comment(2)
This helped me fix a problem related to moving the tabBar to the top of the screen. Thank you!Excise
But not for me :(Fara
V
11

I had the same problem.

enter image description here

If I set any non-zero constant on the UITabBar's bottom constraint to the safe area:

enter image description here

It starts working as expected...

enter image description here

That is the only change I made and I have no idea why it works but if anyone does I'd love to know.

Vorlage answered 14/12, 2017 at 19:51 Comment(2)
This was what i did at the end to get it working, but yeah I have no idea why or understand what it's doing. To me it still feels like a bugResolute
Still happening today, 6 years later, with iPhone 14 pro max, and this fixed it.Halftruth
A
7

Fixed by using subclassed UITabBar to apply safeAreaInsets:

class SafeAreaFixTabBar: UITabBar {

    var oldSafeAreaInsets = UIEdgeInsets.zero

    @available(iOS 11.0, *)
    override func safeAreaInsetsDidChange() {
        super.safeAreaInsetsDidChange()

        if oldSafeAreaInsets != safeAreaInsets {
            oldSafeAreaInsets = safeAreaInsets

            invalidateIntrinsicContentSize()
            superview?.setNeedsLayout()
            superview?.layoutSubviews()
        }
    }

    override func sizeThatFits(_ size: CGSize) -> CGSize {
        var size = super.sizeThatFits(size)
        if #available(iOS 11.0, *) {
            let bottomInset = safeAreaInsets.bottom
            if bottomInset > 0 && size.height < 50 {
                size.height += bottomInset
            }
        }
        return size
    }
}
Apricot answered 29/9, 2017 at 10:33 Comment(4)
Solves part of the problems, but not all. Please see the full answer bellowWoven
It worked for me when I try to present VCA, then dismiss VCA, push VCB.Gigantism
This works for me but I need to put the bottom constraint to the superview and not the safe area.Sutherland
What do I do with this new class after I create it? I tried looking through my application for any occurrence of UITabBar and replace them with the SafeAreaFixTabBar... I found these occurrences: func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplicationLaunchOptionsKey: Any]?) -> Bool { SafeAreaFixTabBar.appearance().barTintColor = ... SafeAreaFixTabBar.appearance().backgroundColor = ... SafeAreaFixTabBar.appearance().tintColor = ... But didn't fix anythingNiggle
G
7

Moving the tab bar 1 point away from the bottom worked for me.

Of course you'll get a gap by doing so which you'll have to fill in some way, but the text/icons are now properly positioned.

Goldfish answered 6/12, 2017 at 20:53 Comment(0)
H
7

Aha! It's actually magic!

I finally figured this out after hours of cursing Apple.

UIKit actually does handle this for you, and it appears that the shifted tab bar items are due to incorrect setup (and probably an actual UIKit bug). There is no need for subclassing or a background view.

UITabBar will "just work" if it is constrained to the superview's bottom, NOT to the bottom safe area.

It even works in Interface builder.

Correct Setup

Working in IB

  1. In interface builder, viewing as iPhone X, drag a UITabBar out to where it snaps to the bottom safe area inset. When you drop it, it should look correct (fill the space all the way to the bottom edge).
  2. You can then do an "Add Missing Constraints" and IB will add the correct constraints and your tab bar will magically work on all iPhones! (Note that the bottom constraint looks like it has a constant value equal to the height of the iPhone X unsafe area, but the constant is actually 0)

Sometimes it still doesn't work

Broken in IB

What's really dumb is that you can actaully see the bug in IB as well, even if you add the exact constraints that IB adds in the steps above!

  1. Drag out a UITabBar and don't snap it to the bottom safe area inset
  2. Add leading, trailing and bottom constraints all to superview (not safe area) Weirdly, this will fix itself if you do a "Reverse First And Second Item" in the constraint inspector for the bottom constraint. ¯_(ツ)_/¯
Histogenesis answered 10/6, 2018 at 6:41 Comment(1)
changed all constraints from safe area to superview and worked. Legend RyanSatire
I
4

Solved for me by calling [tabController.view setNeedsLayout]; after dismissing the modal in completion block.

[vc dismissViewControllerAnimated:YES completion:^(){ 
     UITabBarController* tabController = [UIApplication sharedApplication].delegate.window.rootViewController;
     [tabController.view setNeedsLayout];
}];
Indigotin answered 4/4, 2018 at 19:50 Comment(0)
C
2

The UITabBar is increasing in height to be above the home button/line, but drawing the subview in its original location and overlaying the UITabBarItem over the subview.

As a workaround you can detect the iPhone X and then shrink the height of the view by 32px to ensure the tab bar is displayed in the safe area above the home line.

For example, if you're creating your TabBar programatically replace

self.tabBarController = [[UITabBarController alloc] init];
self.window.rootViewController = self.tabBarController;

With this:

#define IS_IPHONEX (([[UIScreen mainScreen] bounds].size.height-812)?NO:YES)
self.tabBarController = [[UITabBarController alloc] init];    
self.window.rootViewController = [[UIViewController alloc] init] ;
if(IS_IPHONEX)
    self.window.rootViewController.view.frame = CGRectMake(self.window.rootViewController.view.frame.origin.x, self.window.rootViewController.view.frame.origin.y, self.window.rootViewController.view.frame.size.width, self.window.rootViewController.view.frame.size.height + 32) ;
[self.window.rootViewController.view addSubview:self.tabBarController.view];
self.tabBarController.tabBar.barTintColor = [UIColor colorWithWhite:0.98 alpha:1.0] ;
self.window.rootViewController.view.backgroundColor = [UIColor colorWithWhite:0.98 alpha:1.0] ;

NOTE: This could well be a bug, as the view sizes and tab bar layout are set by the OS. It should probably display as per Apple's screenshot in the iPhone X Human Interface Guidelines here: https://developer.apple.com/ios/human-interface-guidelines/overview/iphone-x/

Chichi answered 14/9, 2017 at 9:50 Comment(5)
i see, I didn't create the Tab bar programatically, i used the storyboard to build it with constraints set to be the bottom of the screen. It does feel odd to me that we have to detect if it's an iPhone X then go do some rejigging on the layout, while they just bump up the height of the TabBar by it self without any code changes.Resolute
This feels more like a bug to me now, I think i'm going to do a bug report on this and see what comes out of it. Thanks for your help!!Resolute
It's really not a great idea to use the exact height of the main screen bounds to determine if the app is running on iPhone X. What happens if next year's model is the same point size? Or if the app is running in landscape mode?Toehold
Transparency doesn't seem to affect my icons being set improperly. They're messed up whether the UITabBar is opaque or transparent.Jota
It would appear you are actually adding 32px to the height of the frame rather than subtracting from it?Botzow
T
2

My case was that I had set a custom UITabBar height in my UITabBarController, like this:

  override func viewWillLayoutSubviews() {            
        var tabFrame = tabBar.frame
        tabFrame.size.height = 60
        tabFrame.origin.y = self.view.frame.size.height - 60
        tabBar.frame = tabFrame
    }

Removing this code was the solution for the TabBar to display correctly on iPhone X.

Tournai answered 8/2, 2018 at 13:45 Comment(0)
C
2

The simplest solution I found was to simply add a 0.2 pt space between the bottom of the tab bar and the bottom of the safeAreaLayoutGuide.bottomAnchor like so.

tabBar.bottomAnchor.constraint(equalTo: view.safeAreaLayoutGuide.bottomAnchor, constant: -0.2)
Chaldean answered 27/9, 2018 at 22:51 Comment(0)
F
1

I was having the same issue when I was trying to set the frame of UITabBar in my custom TabBarController.

self.tabBar.frame = CGRectMake(0, self.view.frame.size.height - kTabBarHeight, self.view.frame.size.width, kTabBarHeight);

When I just adjusted it to the new size the issue went away

if(IS_IPHONE_X){
    self.tabBar.frame = CGRectMake(0, self.view.frame.size.height - kPhoneXTabBarHeight, self.view.frame.size.width, kPhoneXTabBarHeight);
}
else{
    self.tabBar.frame = CGRectMake(0, self.view.frame.size.height - kTabBarHeight, self.view.frame.size.width, kTabBarHeight);
}
Fearfully answered 14/9, 2017 at 23:27 Comment(6)
What are the values of kPhoneXTabBarHeight ?Hargis
I just added 32 points to the previous value of kTabBarHeight (which was 45). But you don't have to specify exactly the same value, for me it's also works fine without specifying the frame for the tabBar. But if you do specify it, you have to adjust for additional height on iPhone X.Fearfully
Total hack, but it was the only one of these solutions that got it looking right for me.Randallrandan
When you're having a custom view as your tabbar you like to use this hack to make your custom view fit for iPhone X.Outshout
@Evgeny, I guess, the previous value was 49 and not 45.Outshout
@Outshout no, it was 45 for this project I borrowed this code from.Fearfully
B
1

I encountered this today with a a UITabBar manually added to the view controller in the storyboard, when aligning to the bottom of the safe area with a constant of 0 I would get the issue but changing it to 1 would fix the problem. Having the UITabBar up 1 pixel more than normal was acceptable for my application.

Bisect answered 28/9, 2017 at 9:39 Comment(1)
Didn't work for me. I was using a UITabBar that was manually added as well.Randallrandan
I
1

I have scratched my head over this problem. It seems to be associated with how the tabBar is initialized and added to view hierarchy. I also tried above solutions like calling invalidateIntrinsicContentSize, setting the frame, and also bottomInsets inside a UITabBar subclass. They seem to work however temporarily and they break of some other scenario or regress the tab bar by causing some ambiguous layout issue. When I was debugging the issue I tried assigning the height constraints to the UITabBar and centerYAnchor, however neither fixed the problem. I realized in view debugger that the tabBar height was correct before and after the problem reproduced, which led me to think that the problem was in the subviews. I used the below code to successfully fix this problem without regressing any other scenario.

- (void) viewWillTransitionToSize:(CGSize)size withTransitionCoordinator:(id<UIViewControllerTransitionCoordinator>)coordinator
{
    [super viewWillTransitionToSize:size withTransitionCoordinator:coordinator];
    if (DEVICE_IS_IPHONEX())
    {
        [coordinator animateAlongsideTransition:^(id<UIViewControllerTransitionCoordinatorContext>  _Nonnull context) {
            for (UIView *view in self.tabBar.subviews)
            {
                if ([NSStringFromClass(view.class) containsString:@"UITabBarButton"])
                {
                    if (@available (iOS 11, *))
                    {
                        [view.bottomAnchor constraintEqualToAnchor:view.superview.safeAreaLayoutGuide.bottomAnchor].active = YES;
                    }
                }
            }
        } completion:^(id<UIViewControllerTransitionCoordinatorContext>  _Nonnull context) {
            [self.tabBar layoutSubviews];
        }];
    }
}

Assumptions: I am doing this only for iPhone X, since it doesn't seem to reproduce on any other device at the moment. Is based on the assumption that Apple doesn't change the name of the UITabBarButton class in future iOS releases. We're doing this on UITabBarButton only when means if apple adds more internal subviews in to UITabBar we might need to modify the code to adjust for that.

Please lemme know if this works, will be open to suggestions and improvements!

It should be simple to create a swift equivalent for this.

Illusive answered 16/11, 2017 at 1:21 Comment(2)
I put this in the viewDidAppear(animated:) in my UITabBarController and it worked fine. Thanks!Reedy
what param u passed size and coordinator? from view didAppearPredecease
A
1

From this tutorial:

https://github.com/eggswift/ESTabBarController

and after initialization of tab bar writing this line in appdelegate class

(self.tabBarController.tabBar as? ESTabBar)?.itemCustomPositioning = .fillIncludeSeparator

Solves my problem of tab bar.

Hope its solves your problem

Thanks

Airlia answered 11/12, 2017 at 13:55 Comment(0)
E
1

Select tabbar and set "Save Area Relative Margins" checkbox in Inspector Editor like this:

enter image description here

Ethiopia answered 5/1, 2018 at 15:37 Comment(0)
M
1

I had the similar problem, at first it was rendered correctly but after setting up badgeValue on one of the tabBarItem it broke the layout. What it worked for me without subclassing UITabBar was this, on my already created UITabBarController subclass.

-(void)viewDidLayoutSubviews {
    [super viewDidLayoutSubviews];
    NSLayoutYAxisAnchor *tabBarBottomAnchor = self.tabBar.bottomAnchor;
    NSLayoutYAxisAnchor *tabBarSuperviewBottomAnchor = self.tabBar.superview.bottomAnchor;
    [tabBarBottomAnchor constraintEqualToAnchor:tabBarSuperviewBottomAnchor].active = YES;
    [self.view layoutIfNeeded];
}

I used tabBar superview to make sure that the constraints/anchors are on the same view hierarchy and avoid crashes.

Based on my understanding, since this seems to be a UIKit bug, we just need to rewrite/re-set the tab bar constraints so the auto layout engine can layout the tab bar again correctly.

Moltke answered 13/9, 2018 at 4:49 Comment(0)
L
0

If you have any height constraint for the Tab Bar try removing it .

Faced the same problem and removing this solved the issue.

Levitical answered 25/9, 2017 at 12:13 Comment(0)
L
0

I created new UITabBarController in my storyboard and pushed all view controllers to this new UITabBarConttoller. So, all work well in iPhone X simulator.

Lagting answered 25/10, 2017 at 9:33 Comment(1)
This also fixed it for me. There's something different about the way Xcode 9 IB generates the UITabBarController's XML that fixed the issue.Nuclear
S
0

For iPhone you can do this, Subclass UITabBarController.

class MyTabBarController: UITabBarController {

override func viewDidLayoutSubviews() {
    super.viewDidLayoutSubviews()
    if #available(iOS 11, *) {
        self.tabBar.heightAnchor.constraint(equalToConstant: 40).isActive = true
        self.tabBar.invalidateIntrinsicContentSize()
    }
  }
}

Goto Storyboard and allow Use Safe Area Layout Guide and change class of UITabbarController to MyTabBarController

P.S This solution is not tested in case of universal application and iPad.

Solly answered 19/12, 2017 at 7:39 Comment(0)
A
0

try to change splash screen with @3x size is (3726 × 6624)

Ascertain answered 21/1, 2018 at 17:5 Comment(2)
What If we are using a LaunchScreen Storyboard?Carencarena
it's okay just use the splash new sizeAscertain
G
0

For me, remove [self.tabBar setBackgroundImage:] work, maybe it's UIKit bug

Glycoprotein answered 25/1, 2018 at 6:21 Comment(0)
D
0

For me this fixed all the issues:

    override func viewDidLayoutSubviews() {
        super.viewDidLayoutSubviews()
        let currentHeight = tabBar.frame.height
        tabBar.frame = CGRect(x: 0, y: view.frame.size.height - currentHeight, width: view.frame.size.width, height: currentHeight)
    }
Doublereed answered 7/2, 2018 at 14:36 Comment(0)
B
0

I was using a UITabBarController in the storyboard and at first it was working alright for me, but after upgrading to newer Xcode version it started giving me issues related to the height of the tabBar.

For me, the fix was to delete the existing UITabBarController from storyboard and re-create by dragging it from the interface builder objects library.

Bengaline answered 13/8, 2019 at 7:42 Comment(0)
S
0

For those who write whole UITabBarController programmatically, you can use UITabBarItem.appearance().titlePositionAdjustment to adjust the title position

So in this case that you want add a gap between Icon and Title use it in viewDidLoad:

    override func viewDidLoad() {
        super.viewDidLoad()

        // Specify amount to offset a position, positive for right or down, negative for left or up
        let verticalUIOffset = UIOffset(horizontal: 0, vertical: hasTopNotch() ? 5 : 0)

        UITabBarItem.appearance().titlePositionAdjustment = verticalUIOffset
    }

detecting if device has Notch screen:

  func hasTopNotch() -> Bool {
      if #available(iOS 11.0, tvOS 11.0, *) {
        return UIApplication.shared.delegate?.window??.safeAreaInsets.top ?? 0 > 20
      }
      return false
  }
Standley answered 22/5, 2020 at 15:14 Comment(0)
G
0

For me the solution was to select the Tab Bar in the view hierarchy, then go to: Editor -> Resolve Auto Layout Issues, and under "Selected Views" (not "All views in view") choose "Add missing constraints".

Gobbledygook answered 30/8, 2020 at 13:42 Comment(0)
P
-1

I was having the same issue which was solved by setting the items of the tabBar after the tab bar was laid out.

In my case the issue happened when:

  1. There is a custom view controller
  2. A UITabBar is created in the initializer of the view controller
  3. The tab bar items are set before view did load
  4. In view did load the tab bar is added to the main view of the view controller
  5. Then, the items are rendered as you mention.
Plainspoken answered 14/9, 2017 at 20:49 Comment(0)
H
-1

I think this is a bug UIKit from iPhoneX. because it works:

if (@available(iOS 11.0, *)) {
    if ([UIApplication sharedApplication].keyWindow.safeAreaInsets.top > 0.0) {
       self.tabBarBottomLayoutConstraint.constant = 1.0;
    }
} 
Hance answered 25/9, 2017 at 17:40 Comment(1)
can you give more info on what tabBarBottomLayoutConstraint is?Jordanna
M
-1

I believe you might be laying out the tab bar against the bottom safe layout guide. This is probably not what you want since the tab bar does seems to do its own calculations to position the tab bar items safely on top of the home line in the iPhone X. Setup your bottom constraint against the superview bottom. You should see that it lays out correctly on iPhone X as well as other iPhones.

Michamichael answered 9/10, 2017 at 0:17 Comment(0)
L
-1

I ran into this bug on my launch screen storyboard, which can't be customised via subclassing. After some analysis I managed to figure out the cause - I was using a UITabBar directly. Switching to a UITabBarController, which encapsulates a UITabBar, solved the issue.

Note - it is possible that this will be fixed by iOS 11.1, so may not effect real iPhone X apps (since it is likely that the iPhone X will be released running iOS 11.1).

Lucilelucilia answered 9/10, 2017 at 0:50 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.