diff --git a/Demo/Demo.xcodeproj/project.pbxproj b/Demo/Demo.xcodeproj/project.pbxproj index 7811479..e4849eb 100644 --- a/Demo/Demo.xcodeproj/project.pbxproj +++ b/Demo/Demo.xcodeproj/project.pbxproj @@ -409,7 +409,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = B9D8DJR5J5; + DEVELOPMENT_TEAM = 8G74YECJ4Z; INFOPLIST_FILE = Demo/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = ( @@ -429,7 +429,7 @@ buildSettings = { ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon; CODE_SIGN_STYLE = Automatic; - DEVELOPMENT_TEAM = B9D8DJR5J5; + DEVELOPMENT_TEAM = 8G74YECJ4Z; INFOPLIST_FILE = Demo/Info.plist; IPHONEOS_DEPLOYMENT_TARGET = 10.0; LD_RUNPATH_SEARCH_PATHS = ( diff --git a/Sources/Screen/UIAdapter.Screen.swift b/Sources/Screen/UIAdapter.Screen.swift index 7d9736c..3c8e349 100644 --- a/Sources/Screen/UIAdapter.Screen.swift +++ b/Sources/Screen/UIAdapter.Screen.swift @@ -119,7 +119,8 @@ extension UIAdapter { extension UIAdapter.Screen { public static var isZoomedMode: Bool { - UIScreen.main.scale != UIScreen.main.nativeScale + guard !isPlus else { return UIScreen.main.bounds.width == 375 } + return UIScreen.main.scale != UIScreen.main.nativeScale } public enum Width: CGFloat { @@ -131,6 +132,7 @@ extension UIAdapter.Screen { case _428 = 428 public static var current: Width { + guard !isPlus else { return ._414 } return Width(rawValue: nativeSize.width / scale) ?? .unknown } } @@ -147,6 +149,7 @@ extension UIAdapter.Screen { case _926 = 926 public static var current: Height { + guard !isPlus else { return ._736 } return Height(rawValue: nativeSize.height / scale) ?? .unknown } } @@ -164,6 +167,11 @@ extension UIAdapter.Screen { case _6_7 = 6.7 public static var current: Inch { + guard !isPlus else { + // Plus 机型比较特殊 下面公式无法正确计算出尺寸 + return ._5_5 + } + switch (nativeSize.width / scale, nativeSize.height / scale, scale) { case (320, 480, 2): return ._3_5 @@ -208,6 +216,11 @@ extension UIAdapter.Screen { case full public static var current: Level { + guard !isPlus else { + // Plus 机型比较特殊 下面公式无法正确计算出尺寸 + return .regular + } + switch (nativeSize.width / scale, nativeSize.height / scale) { case (320, 480): return .compact @@ -223,6 +236,10 @@ extension UIAdapter.Screen { } } } + + private static var isPlus: Bool { + return nativeSize.equalTo(.init(width: 1080, height: 1920)) + } } extension UIAdapter.Screen { diff --git a/UIAdapter.podspec b/UIAdapter.podspec index b6b8d95..d4abc4a 100644 --- a/UIAdapter.podspec +++ b/UIAdapter.podspec @@ -1,7 +1,7 @@ Pod::Spec.new do |s| s.name = "UIAdapter" -s.version = "1.0.0" +s.version = "1.1.0" s.summary = "iOS屏幕适配工具" s.homepage = "https://github.com/lixiang1994/UIAdapter"