【发布时间】:2016-07-14 16:17:34
【问题描述】:
我正在开发我的应用程序,它使用图表来可视化一些数据。我为此使用了这个漂亮的 Scrollable-GraphView:https://github.com/philackm/Scrollable-GraphView
因为这只是一个继承自 UIScrollView 的类,所以不能与 Interface Builder 一起使用(它也没有实现 init(withCoder:) 函数)。
我现在想用 Interface Builder 添加一个 UIView,它具有在运行时正确调整大小的所有必要约束。如何在运行时用我的 GraphView“替换”那个 UIView?
此方法用于在运行时创建我的图表:
private func createDarkGraph(frame: CGRect) -> ScrollableGraphView {
let graphView = ScrollableGraphView(frame: frame)
// ... some customization
return graphView
}
【问题讨论】:
标签: ios swift uiview uiscrollview