Image Fit to background Screen (swift)

UIGraphicsBeginImageContext(self.view.frame.size)
        UIImage(named: "background.png")?.drawInRect(self.view.bounds)
        
        let image: UIImage! = UIGraphicsGetImageFromCurrentImageContext()
        
        UIGraphicsEndImageContext()
        

        self.view.backgroundColor = UIColor(patternImage: image)
Previous
Next Post »

1 comments:

Write comments
Unknown
AUTHOR
21 December 2017 at 23:49 delete

//background image
UIGraphicsBeginImageContext(self.view.frame.size);
[[UIImage imageNamed:@"login.jpg"] drawInRect:self.view.bounds];
UIImage *image = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();

self.view.backgroundColor = [UIColor colorWithPatternImage:image];

Reply
avatar