I'm writing my own keyboard, and i need buttons to be in distance of each other, so i need to add invisible border for my UIImage so it's my code
func imageWithBorderForImage(initalImage: UIImage, withWidth width: CGFloat, withHeight height: CGFloat) -> UIImage {
UIGraphicsBeginImageContext(CGSizeMake(width , height));
initalImage.drawInRect(CGRectMake(borderSize, borderSize, width - borderSize * 2, height - borderSize));
let resultedImage = UIGraphicsGetImageFromCurrentImageContext();
UIGraphicsEndImageContext();
return resultedImage
}
This code adds border on top and left side as i expected but in bottom and right side it cuts my image. So where is a problem who knows?