asked    Xavier     2018-10-22       ios       94 view        1 Answer

[SOLVED] Swift 4 Xcode 9 Take Screenshots of a View and Save them

I'm trying to put a Button into my App which should take a Screenshot of a View.

I tried different things, but nothing worked (Always got "Thread 1: Signal SIGABRT" as error)

  1 Answer  

        answered    Christine     2018-10-22      

I make a little extension of UIImage with option to transform UIView into UIImage and then to scale image in exactly size that you need. Now you can just init your UIImage with your view line

var image = UIImage(view:myView)

extension UIImage {

    func imageWithImage(scaledToSize newSize:CGSize) -> UIImage?{
        UIGraphicsBeginImageContextWithOptions(newSize, false, 0.0);
        self.draw(in: CGRect(origin: CGPoint.zero, size: CGSize(width: newSize.width, height: newSize.height)))
        let newImage:UIImage = UIGraphicsGetImageFromCurrentImageContext()!
        UIGraphicsEndImageContext()
        return newImage
    }

    convenience init(view: UIView) {
        UIGraphicsBeginImageContext(view.frame.size)
        view.layer.render(in:UIGraphicsGetCurrentContext()!)
        let image = UIGraphicsGetImageFromCurrentImageContext()
        UIGraphicsEndImageContext()
        self.init(cgImage: image!.cgImage!)
    }
}




Your Answer





 2018-10-22         Adam

WebClient doesn't read response until request write is completed.

I'm trying to implement streaming proxy.I faced with the issue with WebClient from spring reactive.Could anyone help me to understand Do I some wrong way or it's just a bug from WebClient side?Stack:reactor-netty 0.7.8.RELEASEspring-boot 2.0.4.RELEASEDesc:I want to proxy a long stream to external service and then forward stream of responses to the requester.Streaming is happening using chunks (HTTP 1.1 Transfer-Encoding : chunked).External service processes every chunk and sends to the response result.Expected behaviour:WebClient should read every received part of response ...
 spring                     1 answers                     68 view
 2018-10-22         Tracy

How to download files from self hosted VM to VSTS

I have python solution which resides in VSTS repository. Using build pipeline and private agent, the source code gets copied to VM.After executing the python files, output is stored in 3 different files at the source directory level.I want to download/copy these output files from private hosted VM to VSTS repository.How can this be achieved?Thank you The only way to get something into the repository is by checking it in via source control. Maybe it's enough for you to just publish these files as a build artifact. You have the option to publish directly to VSTS or to any ...
 azure-devops                     2 answers                     65 view
 2018-10-22         Dick

VSTS Build defination fails at Get Sources step

VSTS Build definition fails at Get Sources step from TFS.Below is the error: "error]Microsoft.VisualStudio.Services.Agent.Util.ProcessExitCodeException: Exit code 1 returned from process: file name 'tf', arguments 'vc get /version:131 /recursive /overwrite D:\a\3\s /loginType:OAuth /login:.,*** /noprompt'."Please help. You might see this error when the changes that you are trying to check in contain a file/folder to a location that is not mapped to list of sources with the build definition.Error message is not beautiful enough but it is there to stop accidental chec...
 build                     1 answers                     65 view