我想以编程方式创建一个由纯色填充的UIImage.任何人都知道如何在Swift中执行此操作?
如何删除分段控件的外边框?我已经将分频器图像设置为我想要的但现在要按照我的应用程序的模拟我需要一个没有外边框的分段控件.
我想在Swift 3中更改UISegmentedControl所选段的tintColor。我在Objective-c中搜索了很多答案。
这是我的代码:
class ViewController:UIViewController{
var segment:UISegmentedControl
override func viewDidLoad() {
super.viewDidLoad()
segment.insertSegment(withTitle: "AAA", at: 0, animated: true)
segment.insertSegment(withTitle: "BBB", at: 1, animated: true)
segment.insertSegment(withTitle: "CCC", at: 2, animated: true)
segment.addTarget(self, action: #selector(changeValue), for: .valueChanged)
segment.selectedSegmentIndex = 0
view.addSubview(segment)
}
func changeValue(sender:AnyObject) {
//I don't know how to do that change color when segment selected
//
}
}
Run Code Online (Sandbox Code Playgroud)
谢谢!