【问题标题】:border in UIImageViewUIImageView 中的边框
【发布时间】:2011-09-03 14:00:17
【问题描述】:

我试图让 UIImageView 的边框如下所示:

我尝试过使用:

[imageView.layer setBorderColor: [[UIColor whiteColor] CGColor]];
[imageView.layer setBorderWidth: 2.0];

但是你看不到外面的灰色边框。它在外面有那种灰色的阴影效果。 我该怎么做?

【问题讨论】:

    标签: iphone uiimageview objective-c++


    【解决方案1】:

    看看CALayer的阴影属性。

    [imageView.layer setShadowOffset:CGSizeMake(-1.0, -1.0)];
    [imageView.layer setShadowOpacity:0.5];
    

    【讨论】:

      【解决方案2】:

      This question 关于向 UIImageView 添加阴影可能会有所帮助

      【讨论】:

        【解决方案3】:
        imageView.layer.shadowOpacity=0.6;
        imageView.layer.shadowRadius = 0.0;
        imageView.layer.shadowColor = [UIColor grayColor].CGColor;
        imageView.layer.shadowOffset = CGSizeMake(-2.0, 1.0);
        

        【讨论】:

          猜你喜欢
          • 2014-03-15
          • 2011-05-31
          • 1970-01-01
          • 2014-12-14
          • 2017-02-09
          • 1970-01-01
          • 2014-09-03
          • 1970-01-01
          • 2018-12-01
          相关资源
          最近更新 更多