Three20 TTStyle 阴影

发布于 2024-12-11 13:52:08 字数 736 浏览 0 评论 0原文

我正在尝试为视图创建一个看起来很漂亮的标题。我正在使用应用了样式的 TTView,但我的问题是我希望阴影仅落在图像下方,而不是侧面。我希望侧面紧贴屏幕边缘。

这是目前的样子:

在此处输入图像描述

我怎样才能使它的侧面难以对抗屏幕边缘?

这是我的样式代码:

UIColor* black = RGBCOLOR(158, 163, 172);
UIColor* blue = RGBCOLOR(191, 197, 208);
TTStyle *style = 
[TTShadowStyle styleWithColor:RGBACOLOR(0,0,0,0.5) blur:5 offset:CGSizeMake(0, 2) next:
[TTLinearGradientFillStyle styleWithColor1:RGBCOLOR(255, 255, 255)
                                    color2:RGBCOLOR(216, 221, 231) next:
[TTFourBorderStyle styleWithTop:blue right:black bottom:black left:blue width:1 next:nil]]];

headerView.style = style;

我非常感谢有关此问题的任何帮助,因为我以前从未使用过 Three20。

I'm trying to create a fancy-looking header to a view. I'm using a TTView with styling applied, but my problem is I want the drop shadow to just drop below the image, and not to the sides. I want the sides hard up against the screen edges.

Here is what it looks like at the moment:

enter image description here

How can I make it so the sides are hard up against the edge of the screen?

Here is my code for the styling:

UIColor* black = RGBCOLOR(158, 163, 172);
UIColor* blue = RGBCOLOR(191, 197, 208);
TTStyle *style = 
[TTShadowStyle styleWithColor:RGBACOLOR(0,0,0,0.5) blur:5 offset:CGSizeMake(0, 2) next:
[TTLinearGradientFillStyle styleWithColor1:RGBCOLOR(255, 255, 255)
                                    color2:RGBCOLOR(216, 221, 231) next:
[TTFourBorderStyle styleWithTop:blue right:black bottom:black left:blue width:1 next:nil]]];

headerView.style = style;

I would appreciate any help with this issue as I've never used three20 before now.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

栖竹 2024-12-18 13:52:08

我最终通过实验发现了这一点 - 如果您在样式链中的投影之前的侧面使用负 UIEdgeMask,它将把主视图推到边缘。

TTStyle *style = 
[TTInsetStyle styleWithInset:UIEdgeInsetsMake(0, -5, 0, -5) next: 
[TTShadowStyle styleWithColor:RGBACOLOR(0,0,0,0.5) blur:5 offset:CGSizeMake(0, 2) next:
[TTLinearGradientFillStyle styleWithColor1:RGBCOLOR(255, 255, 255)
                                    color2:RGBCOLOR(216, 221, 231) next:
[TTFourBorderStyle styleWithBottom:black width:1 next:nil]]]];

I figured it out by experimentation in the end - if you use a negative UIEdgeMask on the sides before the drop-shadow in the style chain, it pushes the main view out to the edges.

TTStyle *style = 
[TTInsetStyle styleWithInset:UIEdgeInsetsMake(0, -5, 0, -5) next: 
[TTShadowStyle styleWithColor:RGBACOLOR(0,0,0,0.5) blur:5 offset:CGSizeMake(0, 2) next:
[TTLinearGradientFillStyle styleWithColor1:RGBCOLOR(255, 255, 255)
                                    color2:RGBCOLOR(216, 221, 231) next:
[TTFourBorderStyle styleWithBottom:black width:1 next:nil]]]];
如果没有 2024-12-18 13:52:08
self.btn1.layer.shadowOffset = CGSizeMake(10, 10); //set the the value for the shade size when the negative that goes to oposite side of current.
    self.btn1.layer.shadowOpacity = 0.9;
    self.btn1.layer.shouldRasterize = YES;
    self.btn1.layer.shadowColor=[[UIColor grayColor]CGColor];

愿这段代码对您有帮助

self.btn1.layer.shadowOffset = CGSizeMake(10, 10); //set the the value for the shade size when the negative that goes to oposite side of current.
    self.btn1.layer.shadowOpacity = 0.9;
    self.btn1.layer.shouldRasterize = YES;
    self.btn1.layer.shadowColor=[[UIColor grayColor]CGColor];

May this code is helping to you

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文