Что является Objective-c эквивалентом Swift customAnnotation.coordinateMode = .relativeY - PullRequest
0 голосов
/ 08 мая 2018

У меня есть следующий код Swift из SciChat Tutorial07 на аннотации. Я ищу функционально эквивалентный код в 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)
        }

1 Ответ

0 голосов
/ 08 мая 2018

Похоже, вам нужны эквивалентные константы Objective-C.

Из документации параметры перечисления для координатного режима:

SCIAnnotationCoordinate_Absolute
SCIAnnotationCoordinate_Relative
SCIAnnotationCoordinate_RelativeX
SCIAnnotationCoordinate_RelativeY

Возможно, вы хотитеSCIAnnotationCoordinate_RelativeY.

...