有没有办法在iOS Swift Project中获取所有UIViewControllers.我想得到所有UIViewControllers的数组并检查是否存在特定的UIViewController.我必须在项目中找到特定的UIViewController是否存在.
我有一个视图,我正在以编程方式应用阴影。但不幸的是,这个阴影出现在这个特定视图的所有子视图上。任何原因。
cellView.layer.shadowColor = UIColor(red: 0, green: 0, blue: 0, alpha: 0.25).cgColor
cellView.layer.shadowOffset = CGSize(width: 0, height: 2)
cellView.layer.shadowOpacity = 1.0
cellView.layer.shadowRadius = 0.0
cellView.layer.masksToBounds = false
cellView.layer.cornerRadius = 4.0
timeLabel = UILabel(frame: CGRect(x: 10, y: 5, width: 50, height: self.bounds.size.height - 30))
timeLabel.font = AmeyoConstants.smallerFont
timeLabel.textColor = UIColor.darkGray
cellView.addSubview(timeLabel)
Run Code Online (Sandbox Code Playgroud)
我只在 cellView 上应用了阴影,但在运行应用程序时,阴影也会自动出现在 timeLabel 上。任何人都可以让我知道从父视图到子视图继承阴影的正确原因。