Giter Site home page Giter Site logo

Comments (17)

starainDou avatar starainDou commented on August 20, 2024 2

+ (void)load {
static dispatch_once_t onceToken;
dispatch_once(&onceToken, ^{
[self changeOrignalSEL:@selector(sizeThatFits:) swizzleSEL:@selector(ddy_SizeThatFits:)];
[self changeOrignalSEL:@selector(layoutSubviews) swizzleSEL:@selector(ddy_LayoutSubviews)];
});
}

+ (void)changeOrignalSEL:(SEL)orignalSEL swizzleSEL:(SEL)swizzleSEL {
Method originalMethod = class_getInstanceMethod([self class], orignalSEL);
Method swizzleMethod = class_getInstanceMethod([self class], swizzleSEL);
if (class_addMethod([self class], orignalSEL, method_getImplementation(swizzleMethod), method_getTypeEncoding(swizzleMethod))) {
class_replaceMethod([self class], swizzleSEL, method_getImplementation(originalMethod), method_getTypeEncoding(originalMethod));
} else {
method_exchangeImplementations(originalMethod, swizzleMethod);
}
}

- (CGSize)ddy_SizeThatFits:(CGSize)size {
CGSize navigationBarSize = [self ddy_SizeThatFits:size];
if (@available(iOS 11, *)) {
navigationBarSize.height = navigationBarSize.height + [[UIApplication sharedApplication] statusBarFrame].size.height;
}
return navigationBarSize;
}

- (void)ddy_LayoutSubviews {

[self ddy_LayoutSubviews];
if (@available(iOS 11, *)) {
    for (UIView *aView in self.subviews) {
        if ([@[@"_UINavigationBarBackground", @"_UIBarBackground"] containsObject:NSStringFromClass([aView class])]) {
            aView.frame = CGRectMake(0, -CGRectGetMinY(self.frame), CGRectGetWidth(self.frame), CGRectGetHeight(self.frame)+CGRectGetMinY(self.frame));
        }
    }
}

}

from cwlateralslide.

CYFCrazy avatar CYFCrazy commented on August 20, 2024 1

如果地图打开,然后跳转到抽屉页面,页面会整体向下偏移40,如果偏移的40恢复原状时,缩放的抽屉会出现bug

from cwlateralslide.

ChavezChen avatar ChavezChen commented on August 20, 2024

这个是苹果系统iOS11的问题。。https://juejin.im/post/5a6bf18ff265da3e5859947f 这个文章的第4大点有解决方案,同时我把解决方法同步到了demo内,可以参考一下。

from cwlateralslide.

haomemo avatar haomemo commented on August 20, 2024

非常感谢,用的方法二,很有用

from cwlateralslide.

ChavezChen avatar ChavezChen commented on August 20, 2024

😁OK

from cwlateralslide.

332862394 avatar 332862394 commented on August 20, 2024

请问一下,我从左边的页面push到下一页,然后pop回来,显示的是主页面,左边的页面收回去了,这样子,用户使用起来,很不方便,请问有没有办法,在pop回来之后,左边的页面仍然保留存在,不消失,就是pop回来显示的不是主界面,而是拉出来的左界面?

from cwlateralslide.

ChavezChen avatar ChavezChen commented on August 20, 2024

#54 看看这个能不能满足哦

from cwlateralslide.

ChavezChen avatar ChavezChen commented on August 20, 2024

@332862394

from cwlateralslide.

ChavezChen avatar ChavezChen commented on August 20, 2024

麻烦描述清楚一点哦,什么bug?来个gif图吧。 用LICEcap可以录gif图

from cwlateralslide.

starainDou avatar starainDou commented on August 20, 2024

无论是设置背景图或者直接修改_UIBarBackground位置信息都并没有从根本上解决问题,如果碰到其他scale可能这两个方法都无能为力了。所以如果去根治本需要从两方面着手,1,更改导航高度(和iOS11一下一致,如普通机型64高度,iPhoneX特例88),然后布局子视图时更改 _UINavigationBarBackground和_UIBarBackground位置信息。

from cwlateralslide.

ChavezChen avatar ChavezChen commented on August 20, 2024

@starainDou 可以先看一下上面链接的文章哦,你所说的去根治本的两方面,文章说得比较详细,demo里面也写了重新布局的方式。至于设置背景图可以解决上面这个问题,因为这种方式比较简单,对项目影响较少,也不一定说没有治根,因为这是苹果的问题,比如苹果可能会写 有背景图的情况下是正常的布局,没有背景图的情况下是异常的布局,于是你设置背景图就正好走的是正常的布局分支,刚好避免了去走异常布局的分支,这个也说不定的,所以再没发现其他问题的情况下,我还是建议设置背景图来得方便。

from cwlateralslide.

ChavezChen avatar ChavezChen commented on August 20, 2024

你这个方式应该也可以。其实都是一个意思,最终把布局纠正对就好了,但是解决的方式来说,你这种交换方法这种应该是最合适的

from cwlateralslide.

GitForTSir avatar GitForTSir commented on August 20, 2024

image点击北京灰色view返回时,collectionView会整体向下移动,有时候还会导致崩溃

from cwlateralslide.

ChavezChen avatar ChavezChen commented on August 20, 2024

@GitForTSir 向下偏移,设置这个 self.edgesForExtendedLayout = UIRectEdgeNone; 或者看看是不是iOS 11 安全区域适配的问题。崩溃的问题贴一下崩溃错误是啥。

from cwlateralslide.

Gxz666 avatar Gxz666 commented on August 20, 2024

手势冲突 导致无法左滑右滑

from cwlateralslide.

OCer avatar OCer commented on August 20, 2024

你好 请问这代码放在哪个地方?? @starainDou

from cwlateralslide.

OCer avatar OCer commented on August 20, 2024

我放在了UINavigationBar分类里 还是没解决我的问题 @starainDou

from cwlateralslide.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.