0

I have this app called BzCalendar created sometime around the year 2011. So with Objective-C and NO storyboard. I'm in the process of converting into Swift with Storyboard, not done yet.

My app is a calendar app with daily, weekly and monthly view. Top configuration of the app. When I run iPhoneX simulator, top and bottom layout is not what apple want. At first I thought this is something have to do with the app programmatically setting view's frame. However It seems the issue is based on the fact my app always adjust the view content with the width "320" I suppose when iPhone5 or so come around, iOS comes with converting the view to 320 width to rescue the app not supporting newer screen size.

I check the size with code:

override func viewDidLayoutSubviews() {
    print("frame: ", self.view.frame)
    print("safeAreaInsets", self.view.safeAreaInsets)
}

The result: frame: (0.0, 0.0, 320.0, 485.0) safeAreaInsets UIEdgeInsets(top: 44.0, left: 0.0, bottom: 0.0, right: 0.0)

320! Now trying to run with iPhone8 frame: (0.0, 0.0, 320.0, 519.0) safeAreaInsets UIEdgeInsets(top: 20.0, left: 0.0, bottom: 0.0, right: 0.0)

Then I've created new project on XCode9 and made simple app: UITabBarController - UIViewController with the same test code above: The Result: frame: (0.0, 0.0, 375.0, 812.0) safeAreaInsets UIEdgeInsets(top: 44.0, left: 0.0, bottom: 83.0, right: 0.0)

Do anyone experienced the same kind of issue before and know what to do with this? I'm expecting 2 steps fixtures: 1) change xcode config? to use actual screen size. 2) do extra works needed for iPhoneX

Please help me out! Sample screen shot of the app

Katsumi
  • 33
  • 9
  • 1
    You either need to add a launch image of the right size or (better) switch to a launch storyboard. See https://stackoverflow.com/questions/46184859/seeing-black-bars-at-the-top-and-bottom-of-the-iphone-x-simulator – Paulw11 Jun 28 '18 at 01:56
  • @Paulw11 Thanks! That was quite easy! It made iPhone8 draws with better quality too! – Katsumi Jun 28 '18 at 02:38

1 Answers1

0

I'm in the process of converting into Swift with Storyboard, not done yet.

To support iPhoneX you don't need to move your app entirely to storyboards.

1) change xcode config? to use actual screen size.

2) do extra works needed for iPhoneX

All you need to do to support iPhoneX is to use storyboard for a launch screens rather then static images.

You could read more on how to do that here: https://useyourloaf.com/blog/using-a-launch-screen-storyboard/

Taier
  • 2,109
  • 12
  • 22