Day 9
Styling the Buttons and Slider
- Buttons can be styled by changing the values in attribute inspector and size inspector.
- But for Slider, we need to write custom code in ViewController’s viewDidLoad Method.
let thumImageNormal = #imageLiteral(resourceName: "SliderThumb-Normal") slider.setThumbImage(thumImageNormal, for: .normal) let thumbImageHighlighted = #imageLiteral(resourceName: "SliderThumb-Highlighted") slider.setThumbImage(thumbImageHighlighted, for: .highlighted) let insets = UIEdgeInsetsMake(0, 14, 0, 14) let trackLeftImage = #imageLiteral(resourceName: "SliderTrackLeft") let trackLeftResizable = trackLeftImage.resizableImage(withCapInsets: insets) slider.setMinimumTrackImage(trackLeftResizable, for: .normal) let trackRightImage = #imageLiteral(resourceName: "SliderTrackRight") let trackRightResizable = trackRightImage.resizableImage(withCapInsets: insets) slider.setMaximumTrackImage(trackRightResizable, for: .normal)
Styling the about screen
- Adding the background image to about screen.
- Making the textview’s background transparent and changing the font, font size, and color of the text
- Styling the button