下打印屏幕顯示我的佈局:如何將子視圖的子視圖置頂?
我的主要觀點,然後頂視圖,然後圖片。
當我按在圖片上,我希望出現在整個視圖半transaprent黑屏:
let scrennRect = UIScreen.mainScreen().bounds
let coverView = UIView(frame: scrennRect)
coverView.backgroundColor = UIColor.blackColor().colorWithAlphaComponent(0.3)
self.view.addSubview(coverView)
但我想我的照片留在coverView的頂部?
有沒有一種方法可以只把圖片放在coverView前面?
是的,但imageView其內部頂視圖不self.view,多數民衆贊成我的問題。 – Kobe
它不工作,因爲我有這個:mainView - > coverview - > topview - > imageView ....頂視圖需要將imageview帶到頂部,然後以某種方式覆蓋視圖。 – Kobe
嘗試此示例:https://github.com/adrianstanciu24/coverView-test/blob/master/testuiimageview/ViewController.swift – Kobe