In my app, I have a method that transforms a UIView
into a UIImage
. It works fine on every device, except on the iPhone 6 plus, which has a higher pixel density.
I am creating the selectionIndicatorImage
for my UITabBar
by transforming a grey view into a UIImage
. I know this is probably not the best practice in this scenario but anyway I need this method working fine for other things on the application.
This is my UIImage
initializer:
convenience init?(view: UIView) {
UIGraphicsBeginImageContextWithOptions(view.bounds.size, view.opaque, 0.0)
view.layer.renderInContext(UIGraphicsGetCurrentContext())
var img = UIGraphicsGetImageFromCurrentImageContext()
UIGraphicsEndImageContext()
self.init(CGImage: img.CGImage)
}
This generates the following results:
iPhone 6 Plus
iPhone 6
Any thoughts?
Cheers