我正在使用自定义控件来显示应用程序中的跑道。跑道数据(纬度/经度)被转换为以米为单位的XY网格。然后,我根据机场参考点制作旋转并适当放置的子视图。
frame
(-957.794,292.167,1975.589,1186.196)bounds
(0,0,1975.589,1186.196)
我的最终目标是将这两个子视图嵌入到自定义UIView类中 - 但我遇到了如何正确扩展的问题
frame
(0,0,300,300)bounds
(0,0,300,300)
这是将我的两个子视图添加到自定义UIControl的结果。显然不是我想做的事。
我已尝试过以下似乎无法正常工作的
我知道这应该是简单的事情,但我似乎遇到了一些精神障碍。
/* - Define RUNWAY Geo DATA - */
let rwyGeo1 = RunwayGeoData(direction1: "8", lat1: lat1, lon1: lon1, direction2: "23", lat2: lat2, lon2: lon2)
let rwyGeo2 = RunwayGeoData( direction1: "13", lat1: 40.12317425, lon1:-76.30378541666667, direction2: "31", lat2:40.11767828333333, lon2:-76.29098628333334)
/* - Define Airport */
var KLNS : Airport = Airport(name: "KLNS - Lancaster", origin: CGPointMake(-76.2943611, 40.1223611))
/* - Add Runways to Airport - */
let rg1 : UIView = KLNS.addGeoRunway(rwyGeo1)
let rg2 : UIView = KLNS.addGeoRunway(rwyGeo2)
// Extract all the subviews + the boudning box
var (box, array) = KLNS.getSubViews()
// Create a temp view to hold runways
let redView = UIView(frame: box)
for v in array {
redView.addSubview(v)
}
redView.backgroundColor=UIColor.redColor()
redView
redView.frame
redView.bounds
let blueView = UIView(frame: CGRectMake(130.0,80.0,300.0,300.0))
for v in array {
blueView(v)
}
blueView =UIColor.blueColor()
// Do some stuff here to fix the frame/bounds etc of BlueView...???