QuintGao / GKNavigationBarViewController

iOS自定义导航栏-导航栏联动
https://www.jianshu.com/p/577755d0d69a
MIT License
727 stars 130 forks source link

On iOS 13, changing layout margins of a private view is not allowed. #26

Closed gaojinhsu closed 4 years ago

gaojinhsu commented 4 years ago

On iOS 13, changing layout margins of a private view is not allowed. So, expanding the frame to eliminate the layout margins can be an alternative solution.

GKNavigationBar.m中的这段代码要改下了。

    // 设置导航item偏移量
    if (GKDeviceVersion >= 11.0 && !GKConfigure.gk_disableFixSpace) {
        self.layoutMargins = UIEdgeInsetsZero;

        for (UIView *subview in self.subviews) {
            if ([NSStringFromClass(subview.class) containsString:@"ContentView"]) {
                // 修复iOS11 之后的偏移
                subview.layoutMargins = UIEdgeInsetsMake(0, self.gk_navItemLeftSpace, 0, self.gk_navItemRightSpace);
                break;
            }
        }
    }
QuintGao commented 4 years ago

2.3.4版本已经移除了