我正在尝试使用 uipresentationcontroller api 视图中的呈现来呈现报价,但它不起作用。我究竟做错了什么?另外,如何动态调整呈现视图的大小以适应文本?谢谢。
这是我的代码:
override func presentationTransitionWillBegin() {
presentedView()!.layer.cornerRadius = 15.0
//adding label for quote to the presented view
let label = UILabel(frame: CGRectMake(presentedView()!.frame.origin.x, presentedView()!.frame.origin.y, presentedView()!.bounds.width, presentedView()!.bounds.height))
label.center = presentedView()!.center
label.textAlignment = NSTextAlignment.Center
label.text = readQuotesFromLibrary()
presentedView()?.addSubview(label)
//rest of the code dealing with uipresentationcontroller goes here ...