我想使用uipresentationcontroller api视图中的呈现来呈现报价,但它不起作用。我究竟做错了什么?另外,如何动态调整呈现的视图以适应文本?谢谢。如何在swift中居中使用子视图中的标签
这是我的代码:
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 ...
谢谢。事件,如果我删除中心分配它不能解决问题 – irkinosor
好吧,让我知道其背景颜色是呈现viewView? –
呈现的视图应该是白色的 – irkinosor