学习 SWIFT。我似乎无法从我的视图中访问边界......无论我在哪个平台上工作,边界都会返回相同的值(600,600)。
我有一个 graphView : UIView & controller 嵌入在 navigationController 作为 SplitViewController 的详细信息。
我正在尝试获取我的 graphView 的中心:屏幕上的 UIView(splitViewController 的详细信息),但中心一直返回一个点太远(纵向)/底部(横向)。
我尝试了多种方式访问它,但也许我对它的理解是错误的?
例子:var screenCenter: CGPoint = convertPoint( center, fromView: superview)
println("bounds are \(bounds)") // view boundaries
println("frame is at \(frame)") // frame where the view resides
println(" center is at \(center)")
println(" ScreenCenter is at \(screenCenter)")
(输出)
bounds are (0.0,0.0,600.0,600.0)
frame is at (0.0,0.0,600.0,600.0)
center is at (300.0,300.0)
ScreenCenter is at (300.0,300.0)
-> 我如何真正到达中心?SplitView 地理联合 master + detail 吗?
- >似乎x定位在纵向(但不是y)中是正确的,并且y在纵向中是正确的(但不是x)