Skip to content

Commit

Permalink
发布1.6.1版本,修复对iPhoneX系列设备的支持,添加对Application Extentsion上使用布局库的支持: #issue81
Browse files Browse the repository at this point in the history
  • Loading branch information
youngsoft authored and oubaiquan committed Sep 20, 2018
1 parent eac51d7 commit baeaab2
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 28 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,12 @@
**MyLayout**的所有版本的变更日志都将会在这里记录.

---
## [V1.6.1](https://github.com/youngsoft/MyLinearLayout/releases/tag/1.6.1)(2018/09/29)
#### Fixed
1. 修复对所有iPhoneX系列的设备的布局视图在设置padding的值为safeAreaMargin时的BUG。
2. 添加对Application Extension上使用布局库视图的支持。[BUG#81](https://github.com/youngsoft/MyLinearLayout/issues/81)


## [V1.6.0](https://github.com/youngsoft/MyLinearLayout/releases/tag/1.6.0)(2018/08/04)

#### Added
Expand Down
2 changes: 1 addition & 1 deletion MyLayout.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Pod::Spec.new do |s|
#

s.name = "MyLayout"
s.version = "1.6.0"
s.version = "1.6.1"
s.summary = "MyLayout is an iOS UI framework integrates the functions with Android,AutoLayout,SizeClass,HTML CSS float and flexbox,UIView UITableView."

s.description = <<-DESC
Expand Down
2 changes: 1 addition & 1 deletion MyLayout/Lib/MyLayout.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
*/


//Current version is 1.6.0, please open: https://github.com/youngsoft/MyLinearLayout/blob/master/CHANGELOG.md to show the changes.
//Current version is 1.6.1, please open: https://github.com/youngsoft/MyLinearLayout/blob/master/CHANGELOG.md to show the changes.


#ifndef MyLayout_MyLayout_h
Expand Down
48 changes: 22 additions & 26 deletions MyLayout/Lib/MyLayoutSizeClass.m
Original file line number Diff line number Diff line change
Expand Up @@ -637,7 +637,15 @@ -(CGFloat)myLayoutTopPadding
//如果padding值是特殊的值。
if (self.topPadding >= MyLayoutPos.safeAreaMargin - 2000 && self.topPadding <= MyLayoutPos.safeAreaMargin + 2000)
{
return self.topPadding - MyLayoutPos.safeAreaMargin + CGRectGetHeight([UIApplication sharedApplication].statusBarFrame);

CGFloat topPaddingAdd = 20.0; //默认高度是状态栏的高度。
#if (__IPHONE_OS_VERSION_MAX_ALLOWED >= 110000) || (__TV_OS_VERSION_MAX_ALLOWED >= 110000)

if (@available(iOS 11.0, *)) {
topPaddingAdd = self.view.safeAreaInsets.top;
}
#endif
return self.topPadding - MyLayoutPos.safeAreaMargin + topPaddingAdd;
}

if ((self.insetsPaddingFromSafeArea & UIRectEdgeTop) == UIRectEdgeTop)
Expand All @@ -659,15 +667,11 @@ -(CGFloat)myLayoutBottomPadding
if (self.bottomPadding >= MyLayoutPos.safeAreaMargin - 2000 && self.bottomPadding <= MyLayoutPos.safeAreaMargin + 2000)
{
CGFloat bottomPaddingAdd = 0;
#if TARGET_OS_IOS
//如果设备是iPhoneX就特殊处理。竖屏是34,横屏是21
if ([UIScreen mainScreen].bounds.size.height == 812 || [UIScreen mainScreen].bounds.size.width == 812)
{
if (UIDeviceOrientationIsLandscape([UIDevice currentDevice].orientation))
bottomPaddingAdd = 21;
else
bottomPaddingAdd = 34;
}
#if (__IPHONE_OS_VERSION_MAX_ALLOWED >= 110000) || (__TV_OS_VERSION_MAX_ALLOWED >= 110000)

if (@available(iOS 11.0, *)) {
bottomPaddingAdd = self.view.safeAreaInsets.bottom;
}
#endif
return self.bottomPadding - MyLayoutPos.safeAreaMargin + bottomPaddingAdd;
}
Expand All @@ -691,14 +695,10 @@ -(CGFloat)myLayoutLeadingPadding
if (self.leadingPadding >= MyLayoutPos.safeAreaMargin - 2000 && self.leadingPadding <= MyLayoutPos.safeAreaMargin + 2000)
{
CGFloat leadingPaddingAdd = 0;
#if TARGET_OS_IOS
//如果设备是iPhoneX就特殊处理。竖屏是34,横屏是21
if ([UIScreen mainScreen].bounds.size.height == 812 || [UIScreen mainScreen].bounds.size.width == 812)
{
if (UIDeviceOrientationIsLandscape([UIDevice currentDevice].orientation))
leadingPaddingAdd = 44;
else
leadingPaddingAdd = 0;
#if (__IPHONE_OS_VERSION_MAX_ALLOWED >= 110000) || (__TV_OS_VERSION_MAX_ALLOWED >= 110000)

if (@available(iOS 11.0, *)) {
leadingPaddingAdd = self.view.safeAreaInsets.left; //因为这里左右的缩进都是一样的,因此不需要考虑RTL的情况。
}
#endif
return self.leadingPadding - MyLayoutPos.safeAreaMargin + leadingPaddingAdd;
Expand Down Expand Up @@ -741,14 +741,10 @@ -(CGFloat)myLayoutTrailingPadding
if (self.trailingPadding >= MyLayoutPos.safeAreaMargin - 2000 && self.trailingPadding <= MyLayoutPos.safeAreaMargin + 2000)
{
CGFloat trailingPaddingAdd = 0;
#if TARGET_OS_IOS
//如果设备是iPhoneX就特殊处理。竖屏是34,横屏是21
if ([UIScreen mainScreen].bounds.size.height == 812 || [UIScreen mainScreen].bounds.size.width == 812)
{
if (UIDeviceOrientationIsLandscape([UIDevice currentDevice].orientation))
trailingPaddingAdd = 44;
else
trailingPaddingAdd = 0;
#if (__IPHONE_OS_VERSION_MAX_ALLOWED >= 110000) || (__TV_OS_VERSION_MAX_ALLOWED >= 110000)

if (@available(iOS 11.0, *)) {
trailingPaddingAdd = self.view.safeAreaInsets.right;
}
#endif
return self.trailingPadding - MyLayoutPos.safeAreaMargin + trailingPaddingAdd;
Expand Down

0 comments on commit baeaab2

Please sign in to comment.