我是 iOS 新手,请考虑。以下是我设计的屏幕
AttendanceViewController
class AttendanceViewController: UIViewController,UIApplicationDelegate,
UICollectionViewDelegateFlowLayout,UINavigationControllerDelegate,
CLLocationManagerDelegate,UIImagePickerControllerDelegate {
@IBOutlet weak var loginstatus: UILabel!
@IBOutlet weak var displayloginimg: UIImageView!
override func viewWillAppear(_ animated: Bool) {
loginstatus.layer.zPosition = 1
}
// start give attendance
@IBAction func giveLoginbtn(_ sender: Any) {
}
}
Note: Camera Button is not showing when I load image in the displayloginimg: UIImageView! I add this line
loginstatus.layer.zPosition = 1
soLogin Label
is showing,But Camera Button is not showing..
最佳答案
尝试使用 bringSubviewtoFront
方法将层次结构中的 View 移动到另一个 View 的前面,而不是 layer.zPosition
。
self.view.bringSubview(toFront: yourView)
代码:
override func viewWillAppear(_ animated: Bool) {
self.view.bringSubviewToFront(loginstatus)
}
// start give attendance
@IBAction func giveLoginbtn(_ sender: Any) {
let camButton = sender as! UIButton
self.view.bringSubviewToFront(camButton)
}
关于ios - 如何使用 swift 在 IOS 中的另一个 ImageVIew 上显示一个 Imageview,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/53517499/