How to apply a gradient tint over a background image?
Set the background image
The first step is to set the background image. I wanted the image to cover the entire device, so scale aspect fill will be required.
self.backgroundImage = UIImageView(image: UIImage(named: "bgkMain")) self.backgroundImage.contentMode = .scaleAspectFill self.view.insertSubview(self.backgroundImage, at: 0)
Adding a floating decimal point for n number of places is quite easy to achieve. The key to understand is the receive an outcome of a fraction the numbers need to be Double. So Int numbers will result in a whole number product. By way of example:
- 80 / 3 = 26
We know that this result is incorrect. To get the correct outcome the equation needs to be as follows:
During the process of building the app, there are warnings about the code. It's good practice to remove all warnings before you submit your apps to the App Store so there's a few steps you can follow to silence these warnings:
- Navigate the the Project Settings page below;
- Select the drop down menu next to Devices;
- Change from Universal to iPhone; then
- Run your app again and the warnings should disappear.
If you have this error, the core issue is the dyld issue.
dyld is a shared library (
The error is a product where the library path cannot be found at run time. Most likely you have installed a framework to your project and there is an issue in the standard location (such as /Library/Frameworks) on your build and the framework that you have added.
After a short amount searching I came across Kyle Browning Waterwheel Pod. I flipped down to installation and there it is in three steps. Super. But wait. Step one, CocoaPods. What are pods?
Easy to follow, in no time cocoapods are added.