作者热门文章
- Java 双重比较
- java - 比较器与 Apache BeanComparator
- Objective-C 完成 block 导致额外的方法调用?
- database - RESTful URI 是否应该公开数据库主键?
我有以下关于注释的 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/
我有以下关于注释的 SciChat Tutorial07 中的 Swift 代码。我正在 Objective C 中寻找功能等效的代码。不幸的是,我找不到任何相关示例。 SciChart 社区的任何人
我是一名优秀的程序员,十分优秀!