how to set a background image as colorWithPatternImage in swift

Refer to the UIColor documentation.

In Swift, you have to call a convenience initializer. This is because in Swift, all Objective-C class methods which return an instance of their class become convenience initializers.

Here’s how it looks in Swift:

 self.view.backgroundColor = UIColor(patternImage: UIImage(named: "background.png"))

+ (UIColor *)colorWithPatternImage:(UIImage *)image returns a UIColor instance, so it will become a convenience initializer in Swift. Similarly, UIImage imageNamed: becomes init(patternImage image: UIImage!).

Leave a Comment

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)