skip to Main Content

Ios swift – Adding Constraints to view, whose topAnchor's is bottomAnchor of UIView with dynamic height, Swift, UIKit, Programmatic

I've created a UIView, which has buttons in it. I set the constraints like this : NSLayoutConstraint.activate([ sampleView.topAnchor.constraint(equalTo: topView.bottomAnchor, constant: 20), sampleView.leadingAnchor.constraint(equalTo: view.leadingAnchor, constant: 16), sampleView.trailingAnchor.constraint(equalTo: view.trailingAnchor, constant: -16), ]) Not added any height or bottom anchor as I want…

VIEW QUESTION

Ios swift – How to take programatically take screenshot of an app in iOS with UIAlertController as the top controller?

extension UIViewController { static func takeScreenshot() -> UIImage? { guard let topController = UIApplication.getTopController() else { return nil } if let view = topController.view { UIGraphicsBeginImageContextWithOptions(view.bounds.size, false, UIScreen.main.scale) defer { UIGraphicsEndImageContext() } if let context = UIGraphicsGetCurrentContext() { view.layer.render(in: context)…

VIEW QUESTION
Back To Top
Search