0

This line of code to be converted to safe area for iPhone X

    self.view.translatesAutoresizingMaskIntoConstraints = NO;
id views = @{
    @"carbonTabSwipe" : self.view,
    @"topLayoutGuide" : rootViewController.topLayoutGuide,
    @"bottomLayoutGuide" : rootViewController.bottomLayoutGuide
};

NSString *verticalFormat = @"V:[topLayoutGuide][carbonTabSwipe][bottomLayoutGuide]";
[rootViewController.view
    addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:verticalFormat
                                                           options:0
                                                           metrics:nil
                                                             views:views]];
[rootViewController.view
    addConstraints:[NSLayoutConstraint constraintsWithVisualFormat:@"H:|[carbonTabSwipe]|"
                                                           options:0
                                                           metrics:nil
                                                             views:views]];

This works for other devices but iPhone X it shows space at the bottom.

niravdesai21
  • 4,818
  • 3
  • 22
  • 33
  • 2
    Possible duplicate of [Swift Safe Area Layout Guide and Visual Format Language](https://stackoverflow.com/questions/46479288/swift-safe-area-layout-guide-and-visual-format-language) – holex Jul 23 '18 at 14:52
  • What do you mean it shows space at the bottom? – Ladislav Jul 24 '18 at 12:49

0 Answers0