我想使用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