Your First Swift 4 & iOS 12 App Online Course – Day 9

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)

 

Learning iOS Development Day 9 After styling buttons and slider
After styling buttons and slider

 

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

 

Learning iOS Development Day 9 Styling the about screen
Styling the about screen