给定如下所示的 ScrollView 如果我有如下所示的 ScrollView,我可以在 1 到 10 的 CircleView 之后再次显示 1 到 10 吗?
我想使用相同的 1-10 值并在 10 后显示 1, 2, 3....10。 我想使用相同的 1...10 值并在 10 后显示 1, 2, 3...10 。
struct ContentView: View {
var body: some View {
VStack {
Divider()
ScrollView(.horizontal) {
HStack(spacing: 10) {
ForEach(0..<10) { index in
CircleView(label: "\(index)")
}
}.padding()
}.frame(height: 100)
Divider()
Spacer()
}
}
}
struct CircleView: View {
@State var label: String
var body: some View {
ZStack {
Circle()
.fill(Color.yellow) …Run Code Online (Sandbox Code Playgroud) 我在两周内遇到了麻烦,所以请让我提问.
情况
XCode 7.2 Apple Swift 2.1.1版(swiftlang-700.1.101.15 clang-700.1.81) https://github.com/yosuke1985/ios-charts
iOS Chart ttps://github.com/danielgindi/ios-charts
这段代码来自
TTP://www.appcoda.com/ios-charts-api-tutorial/
我想要的是
我想使用这个框架,但错误是EXEC_BAC_ACCESS,
我只通过StoryBoard将窗口对象放在Viewcontroller上,并作为BarChartView类连接.
并且想要显示条形图,当我更改属性时,"noDataText"和"noDataTextDescription"它不起作用,并且无法弄清楚错误来自.
barChartView.noDataText = "there is no data"
barChartView.noDataTextDescription = "give me the reason"
Run Code Online (Sandbox Code Playgroud)
只有这些代码不起作用,我开始认为问题来自Swift或XCode的版本?请给我建议解决这个问题.
错误
import UIKit
import Charts
class ViewController: UIViewController {
var months: [String]!
@IBOutlet weak var barChartView: BarChartView!
override func viewDidLoad() {
super.viewDidLoad()
// Do any additional setup after loading the view, typically from a nib.
barChartView.noDataText = "there is no data"
barChartView.noDataTextDescription = "give me the reason" …Run Code Online (Sandbox Code Playgroud)