swift - 如何在 - 和 + 符号之间放置步进值?
问题描述
我正在以编程方式尝试自定义 UIStepper。我想将 stepper.value 放在 - 和 + 按钮之间,并且我想将步进器的背景更改为白色。
我该怎么做?
这是我所拥有的不起作用的:
let stepper = UIStepper(frame: CGRect(x: 0, y: 0, width: 200, height: 40))
stepper.minimumValue = 0
stepper.center = self.contentView.center
stepper.backgroundColor = .white
stepper.layer.backgroundColor = UIColor.white.cgColor
stepper.stepValue = 1
stepper.tintColor = UIColor(hex: Constants.Colors.primary)
stepper.setIncrementImage(UIImage(named: "icon_cart_plus"), for: .normal)
stepper.setDecrementImage(UIImage(named: "icon_cart_minus"), for: .normal)
解决方案
推荐阅读
- php - 从 WooCommerce 获取优惠券描述订单应用优惠券
- python-3.x - 我的 kivy 代码没有在按钮上显示图像
- c# - 路径中的非法字符:Visual Studio 2019
- bash - 如何使用 CURL 命令进行网站健康检查
- regex - htaccess 规则
使用模糊用户代理 - apache-kafka - kafka监听多个接口
- r - DBI::dbWriteTable 没有将 SQLite 表写入磁盘
- c++ - 当我启用 NVidia Optimus 时,为什么在 D3D11 中我的纹理上会出现条纹
- c++ - 将 adobe xd 文件导入 c++ 项目
- c# - 通过 COM 调用 .NET 方法,使用 ref 数组