Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

如何设置卡片类型? #161

Open
2 tasks
YuanJiaShuai opened this issue Jul 22, 2021 · 8 comments
Open
2 tasks

如何设置卡片类型? #161

YuanJiaShuai opened this issue Jul 22, 2021 · 8 comments

Comments

@YuanJiaShuai
Copy link

New Issue Checklist

Issue Info

Info Value
Platform Name e.g. iOS / macOS
Platform Version e.g. 12.0 / 10.14.0
TABAnimated Version e.g. 5.0.0 / 4.4.0
Xcode Version e.g. Xcode 11 / Xcode 10
Repro rate e.g. all the time (100%) / sometimes x% / only once
Repro with our demo prj e.g. does it happen with our demo project?
Demo project link e.g. link to a demo project that highlights the issue

Issue Description and Steps

Please fill in the detailed description of the issue (full output of any stack trace, compiler error, ...) and the steps to reproduce the issue.
image
你好,我现在cell上面的控件是添加在contentView上面的,这样卡片类型需要设置些什么才能生效呀?图片上代码示例是demo 中的,我修改为添加到contentView上,demo的卡片样式同样不生效了

@tigerAndBull
Copy link
Owner

这样自动化识别卡片视图是无法永远适配所有情况的。这样写卡片视图也是不建议的。
你可以通过一下方式达到卡片目的

  1. 你可以将shaow属性设置给contentView
  2. 你可以设置manager.backgroundComponent.layer

@tigerAndBull tigerAndBull added invalid This doesn't seem right and removed invalid This doesn't seem right labels Jul 22, 2021
@YuanJiaShuai
Copy link
Author

大佬,我用你说的第二种写法,
image
因为我的card 左右上下都有边距,我现在这种写法不生效,只有阴影,并不会右移和宽度减少

@ShiChenZhi
Copy link

我改了源码,成功解决了这个问题,同时可以设置card的背景色及backgroundLayer的背景色,还可以设置左右边距等需求。原理就是cellContenView上的cardBgView作为一个layer添加到backgroundLayer上面。
02
04
06

@tigerAndBull
Copy link
Owner

tigerAndBull commented Jul 28, 2021 via email

@ShiChenZhi
Copy link

可以调整一下作为一个通用api

@tigerAndBull
Copy link
Owner

tigerAndBull commented Jul 28, 2021 via email

@ShiChenZhi
Copy link

当card层颜色与backgroundLayer层颜色不一样时,只有这样才能实现

@tigerAndBull
Copy link
Owner

当card层颜色与backgroundLayer层颜色不一样时,只有这样才能实现

不需要,请看上面,根本不需要动源码。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants