IOS Iphonex Adapter

Source: Internet
Author: User

question one: adaptation 1. First a simple definition of Iponex

#define ISIPHONEX (screenheight = 812.0f)? Yes:no 2. A simple understanding of the Iphonex navigation bar status bar tabar height

1. Navigation bar height 88 non-Iponex mobile phone is 64

2. Status bar height 44 non Iponex mobile phone is 20

The 3.tabar height 83 Iphonex mobile phone is 49 as shown in the following figure;



3. Define its height

#define Heightnavcontentbar 44.0f

#define Heightstatusbar (isiphonex==yes)? 44.0f:20.0f

#define Heightnavbar (isiphonex==yes)? 88.0f:64.0f

#define Heighttabbar (isiphonex==yes)? 83.0f:49.0f

That's it. You've solved the problem of suitability, only for custom navigation bar question two: push when tabbar up and cause a small black screen

Briefly, this is a face bug for an Apple official developer, directly on the code below;

Add this method to your base class navigation controller's jump proxy method;

-(void) Pushviewcontroller: (Uiviewcontroller *) Viewcontroller animated: (BOOL) Animated {

[Super Pushviewcontroller:viewcontroller animated:animated];

Modify the Tabbra frame

CGRect frame = self.tabBarController.tabBar.frame;

FRAME.ORIGIN.Y = [UIScreen mainscreen].bounds.size.height-frame.size.height;

Self.tabBarController.tabBar.frame = frame;

problem Three: UIWebView loading the side black screen loaded to restore

The reason is unknown, directly on the code, in the initialization of WebView, this method can be set;

if (@available (IOS 11.0, *)) {

_webview.scrollview.contentinsetadjustmentbehavior = Uiscrollviewcontentinsetadjustmentnever;

}

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.