Swift uitextview添加文本

loading...


-2

我使用信标制作了位置定位应用程序 . 我想显示我的追踪位置,以及当前位置 . 但数据不断重叠,所以我无法在我的应用程序中识别它 . 如何将textview更新为不重叠的列表?

这是我的代码

func indoorLocationManager(_ manager: EILIndoorLocationManager, didUpdatePosition position: EILOrientedPoint, with positionAccuracy: EILPositionAccuracy, in location: EILLocation) {    
    let now = NSDate()
    let dateFormatter = DateFormatter()
    dateFormatter.dateFormat = "yyyy-MM-dd HH:mm:ss"
    dateFormatter.locale = NSLocale(localeIdentifier: "ko_KR") as Locale


    var ps = String(format: "x: %5.2f, y: %5.2f, orientation: %3.0f",
                   position.x, position.y, position.orientation)
    print(ps)
    print(now)

    let positionRect = CGRect(x: 0, y: 0, width: 430, height: 21)
    let positiontext = UITextView(frame: positionRect)
    positiontext.center = CGPoint(x: 160, y: 450)
    positiontext.backgroundColor = UIColor.white
    positiontext.textAlignment = .center
    positiontext.textColor = UIColor.black
    positiontext.text = ps
   // positiontext.text = dateFormatter.string(from: now as Date)
    positiontext.isScrollEnabled = true
}

loading...

0回答

No Data

评论

暂时没有评论!