【发布时间】:2018-05-08 01:51:01
【问题描述】:
我在注释上有以下来自 SciChat Tutorial07 的 Swift 代码。 我在 Objective C 中寻找功能等效的代码。不幸的是我找不到任何相关的例子。 SciChart 社区的任何人都可以帮忙吗?谢谢!
let totalCapacity = 500.0
// annotation collection property, used to store all annotations
let annotationGroup = SCIAnnotationCollection()
if (i%100 == 0){
let customAnnotation = SCICustomAnnotation()
let customAnnotationContentView = UILabel(frame: CGRect.init(x: 0, y: 0, width: 10, height: 10))
customAnnotationContentView.text = "Y"
customAnnotationContentView.backgroundColor = UIColor.lightGray
customAnnotation.contentView = customAnnotationContentView
customAnnotation.x1 = SCIGeneric(i)
customAnnotation.y1 = SCIGeneric(0.5)
customAnnotation.coordinateMode = .relativeY
// adding new custom annotation into the annotationGroup property
annotationGroup.add(customAnnotation)
// removing annotations that are out of visible range
let customAn = annotationGroup.item(at: 0) as! SCICustomAnnotation
if(SCIGenericDouble(customAn.x1) < Double(i) - totalCapacity){
// since the contentView is UIView element - we have to call removeFromSuperView method to remove it from screen
customAn.contentView.removeFromSuperview()
annotationGroup.remove(customAn)
}
【问题讨论】:
标签: objective-c swift annotations scichart