gpt4 book ai didi

objective-c - Swift customAnnotation.coordinateMode = .relativeY 的 Objective-c 等价物是什么

转载 作者:搜寻专家 更新时间:2023-11-01 07:02:38 25 4
gpt4 key购买 nike

我有以下关于注释的 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 常量。

来自documentation ,您的 coordinateMode 的枚举选项是:

SCIAnnotationCoordinate_Absolute
SCIAnnotationCoordinate_Relative
SCIAnnotationCoordinate_RelativeX
SCIAnnotationCoordinate_RelativeY

您可能需要 SCIAnnotationCoordinate_RelativeY。

关于objective-c - Swift customAnnotation.coordinateMode = .relativeY 的 Objective-c 等价物是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50224650/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com