1

I have the following Swift code from SciChat Tutorial07 on annotations. I am looking for functionally equivalent code in Objective C. Unfortunately i could not find any relevant examples. Could anyone from the SciChart community please help. Thanks!

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)
        }
4

1 回答 1

2

看起来您需要等效的 Objective-C 常量。

文档中,您的坐标模式的枚举选项是:

SCIAnnotationCoordinate_Absolute
SCIAnnotationCoordinate_Relative
SCIAnnotationCoordinate_RelativeX
SCIAnnotationCoordinate_RelativeY

您可能需要 SCIAnnotationCoordinate_RelativeY。

于 2018-05-08T02:38:14.987 回答