Previous adaptation methods

Apple’s latest model is super ugly with bangs. I think Steve Jobs is going to stop it, and I don’t think facial recognition is going to work either. 5StouchID is so sensitive, when you put a pressure screen on it, touchID looks like shit. And that pressure screen of yours, tap, tap, tap, tap, tap, tap, that’s not really useful at all right, apple user experience, just my opinion.

Anyway, he’s the dad, so let him do whatever he wants. So let’s just look at the fit now, and I’ll just tell you about my previous fit, manunload. Yeah, if you use this, you don’t have to worry about screen size, do you? Some of the project’s old code, however, was original code, and apple made a SafeArea thing starting with the bangs screen. The old code macro defines two classes, lsRadioX and lsRadioY

#define lsRadioX [[UIScreen mainScreen] bounds].size.width/375
#define lsRadioY [UIScreen mainScreen].bounds.size.height/667
Copy the code

This is how these two lines of code work. We multiply the x coordinate of the design script (our design script is the iPhone 6 design script) by lsRadioX to get the coordinates of any theoretical screen width. The design button length is 60, so 60 is 60/375 of the screen width of the iPhone 6, so any screen width is 60/375 of the bounds].size.width.

The current fit

First, new models need to add the corresponding LaunghImage, which I won’t mention. In addition, bangs screen adaptation scheme, also temporarily not to discuss, because 1 is our design does not consider this thing, the other is not studied. As for the above method, it has encountered great problems since now. Because the iphoneX and XsMax are designed to be extremely long, it and the iPhone 6 basically use the same design script and can’t be done in a simple way by direct scaling. So now I can only write one macro

#define lsRadioY ([UIScreen mainScreen].bounds.size.height>736? 1:[UIScreen mainScreen].bounds.size.height/667)
Copy the code

Even so, there are still some page adaptation problems, the reason is simple, because Apple’s full screen, out of a safeArea. The original viewable area of the phone is the safe area, but the iphoneX is not. Instead, it cuts the head 88 distance (yes, since the status bar has changed from 20 to 44, the navigation bar is 88), and the bottom 34 distance (the rounded corner at the bottom).

Well, probably like this, write things to facilitate their deeper understanding, there is a chance to help others higher, I know that unskilled, here is a write more detailed, involving iOS11 adaptation, this article temporarily not quoted. Cut trees https://www.. Com/p / 3 a9ad4f0fa32