iOS应用商店有一个蓝色的圆形边框按钮,用于购买/下载应用程序。
在我的应用程序中,你可以下载额外的内容,我想有一个类似的按钮,只是因为它看起来很熟悉的用户。
如果你不知道,我的意思是:这些按钮,比如"$3.99“
这怎麽可能?
发布于 2013-10-03 01:26:01
您可以很容易地操作按钮的CALayer来完成此操作。
// assuming you have a UIButton or more generally a UIView called buyButton
buyButton.layer.cornerRadius = 2;
buyButton.layer.borderWidth = 1;
buyButton.layer.borderColor = [UIColor blueColor].CGColor;
// (note - may prefer to use the tintColor of the control)
您可以调整其中的每一个,以获得您想要的颜色和边框效果。
您还必须在要使用CALayers的任何文件中添加导入
#import <QuartzCore/QuartzCore.h>
发布于 2013-12-21 07:45:57
对于UIButton
、UILabel
等标准iOS控件元素,应使用UIView
tintColor
属性:
buyButton.layer.borderColor = buyButton.tintColor.CGColor;
发布于 2014-03-10 20:59:18
https://stackoverflow.com/questions/19142759
复制相似问题